OpenFormWithData losing IP reference - InfoPath Dev
in

InfoPath Dev

OpenFormWithData losing IP reference

Last post 03-03-2006 01:36 AM by Agni Jonnalagadda. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 03-02-2006 04:28 PM

    • qwer
    • Top 500 Contributor
    • Joined on 10-04-2005
    • Posts 49

    OpenFormWithData losing IP reference

    Ok here's my problem. I used OpenFormWithData() method to launch a form with pre-populated infopath xml via an html page. I had the xml in the correct schema and InfoPath launched successfully with the data that I expected.

    Trouble is when I save the form or submit the form, the resultant xml is not recognised by InfoPath anymore. Opening up the xml file tells me that the <?mso application=”Infopath.Document”> tag is gone mysteriously. Did this happen to anyone? If so, is there a simple fix to it?

    I am working around this problem right now by hacking up the xml file and appending the <?mso application=”Infopath.Document”> tag in there before submitting. Does someone have a simpler and cleaner solution?
  • 03-03-2006 01:36 AM In reply to

    Re: OpenFormWithData losing IP reference

    Verify the XML that you are opening contains "<?mso application=”Infopath.Document”>". If does not you can insert it.

    If you have it in the XML and stil think that InfoPath is removing it, you can add the PI in the code. Here is the code to do it,
    string sAttachmentPI = "mso application='Infopath.Document'";
    string sDomXML = thisXDocument.DOM.xml;
    if(-1 < sDomXML.IndexOf(sAttachmentPI))
    {
    return;
    }
    IXMLDOMDocument2 oTempDom = (IXMLDOMDocument2)thisXDocument.CreateDOM();
    IXMLDOMProcessingInstruction oAttacmentPINode = oTempDom.createProcessingInstruction(sAttachmentPI, "");
    IXMLDOMNode oRootNode = getNode("/rootNodeT");
    oRootNode.parentNode.insertBefore(oAttacmentPINode, oRootNode);
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.