How to insert data into InfoPath form's XML file? - InfoPath Dev
in

InfoPath Dev

How to insert data into InfoPath form's XML file?

Last post 08-31-2008 07:39 PM by Magic. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 08-26-2008 11:44 PM

    • Magic
    • Not Ranked
    • Joined on 08-26-2008
    • Posts 4

    How to insert data into InfoPath form's XML file?

    Hi everyone,

    Currently I get the data from database, and want to insert it into some of my InfoPath project's existing XML files.

    But I don't know how to do load the existing XML files so that I could do some operations on them.

    Any idea would be greatly appreciated! 

     

  • 08-27-2008 01:00 AM In reply to

    • Shiva
    • Top 25 Contributor
    • Joined on 04-15-2005
    • India
    • Posts 694

    Re: How to insert data into InfoPath form's XML file?

    Hello Welcome to the Forums,

    Here is the code to load the xml file, 

    //filePath is the XML file name or path of where it is available.

    //namespaces is the namespace of your file. If you do not have any namespace then pass the empty string.

    private IXMLDOMDocument2 LoadXmlDocument(string filePath, string namespaces)
      {
       IXMLDOMDocument2 xmlDocument = (IXMLDOMDocument2)thisXDocument.CreateDOM();
       xmlDocument.async = false;
       xmlDocument.validateOnParse = false;
       xmlDocument.load(filePath);
       xmlDocument.setProperty("SelectionNamespaces", namespaces);
       return xmlDocument;
      }

    Note: Above code in C#.

  • 08-27-2008 02:41 AM In reply to

    • Magic
    • Not Ranked
    • Joined on 08-26-2008
    • Posts 4

    Re: How to insert data into InfoPath form's XML file?

    Thanks Shiva. It is a great help.

  • 08-31-2008 07:39 PM In reply to

    • Magic
    • Not Ranked
    • Joined on 08-26-2008
    • Posts 4

    Re: How to insert data into InfoPath form's XML file?

    Thanks Shiva very much.

    But now I encounter another problem. I have input some data into InfoPath form's XML file. Then, how to save the file?

     

Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.