Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / November 2004

Tip: Looking for answers? Try searching our database.

How to dynamically bind data from a Web Service?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mattia Saccotelli - 23 Nov 2004 10:42 GMT
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
Greg Collins [InfoPath MVP] - 23 Nov 2004 16:39 GMT
First question is why not base the form off the database so that the main DOM is the database rather than the secondary data source?

Secondly, you can use cloneNode() and replaceChild() to do what you are asking !PROVIDED! the schemas are identical.

Signature

Greg Collins [InfoPath MVP]
Please visit: http://www.InfoPathDev.com

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
Mattia Saccotelli - 25 Nov 2004 15:03 GMT
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);
}

> First question is why not base the form off the database so that the main DOM is the database rather than the secondary data source?
>
> Secondly, you can use cloneNode() and replaceChild() to do what you are asking !PROVIDED! the schemas are identical.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.