How to dynamically bind data from a Web Service?

M

Mattia Saccotelli

Hi,

I would like to fill the DOM with an XML string received from a Web
Service, which will be identical in the structure to the Form's XML,
except the content that'll be the result of a SQL query. A sort of
auto-bind from existing data that will fill some portions of the form.

Is also possible to add controls and elements dynamically? Will they be
recognized from the XML or they need to be added one by one via code?

Thank you in advance,
Mattia
 
M

Mattia Saccotelli

I did the following [C# code]:

[InfoPathEventHandler(MatchPath="CTRL12_5",
EventType=InfoPathEventType.OnClick)]
public void CTRL12_5_OnClick(DocActionEvent e)
{
MSXML2.DOMDocument50Class d = new MSXML2.DOMDocument50Class();
d.async = false;
d.validateOnParse = false;
d.load(@"C:\tmp\xmlDom.xml");
d.setProperty("SelectionNamespaces",
"xmlns:xhtml='http://www.w3.org/1999/xhtml'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xmlns:po='http://schemas.microsoft.com/office/infopath/2003/sample/PurchaseOrder'
xmlns:my='http://schemas.microsoft.com/office/infopath/2003/myXSD'
xmlns:xd='http://schemas.microsoft.com/office/infopath/2003'");
thisXDocument.DOM.replaceChild((Microsoft.Office.Interop.InfoPath.SemiTrust.IXMLDOMNode)d.documentElement,
thisXDocument.DOM.documentElement);
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top