thisXDocument.ImportDOM error - InfoPath Dev
in

InfoPath Dev

thisXDocument.ImportDOM error

Last post 09-05-2006 10:21 AM by Greg Collins. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 09-01-2006 09:28 AM

    thisXDocument.ImportDOM error

    Hi,

    I am having some performance issues when using ReplaceChild to modify the DOM, and am trying to instead use this:

    IXMLDOMDocument newDoc = thisXDocument.CreateDOM();
    newDoc.load(transformedXml.ToString());
    thisXDocument.ImportDOM(newDoc);

    But when this runs, I get the following error:

    System.Runtime.InteropServices.COMException
    This form has an unknown structure.
    #65279;#65279;
    The XML Schema specified for this form could not be identified.

    Has anyone run into this before? I have a feeling that it might be related to the newDoc, it contains xml that was created from running XSLT on the original DOM.
  • 09-01-2006 11:00 AM In reply to

    Re: thisXDocument.ImportDOM error

    The newDoc schema must match exactly that of your form or you will end up with schema errors that will prevent the form from opening.

    Since you've said you applied an XSLT to the original DOM, that would indicate to me that you modified the DOM somehow--possibly changing node names, order or location. Any of these things will cause problems.
  • 09-01-2006 01:57 PM In reply to

    Re: thisXDocument.ImportDOM error

    Ok, I think I've got it. There were a couple of problems - newDoc was complaining about some things, so I turned off validation and loaded it a different way. This pretty much works now (although it is merging the new data into the form instead of replacing it, which I guess ImportDOM is supposed to do).

    IXMLDOMDocument newDoc = hisXDocument.CreateDOM();
    newDoc.validateOnParse = false;
    newDoc.loadXML(transformedXml.ToString());
    thisXDocument.ImportDOM(newDoc);
  • 09-05-2006 10:21 AM In reply to

    Re: thisXDocument.ImportDOM error

    Yes, "Import" is going to pull in additional data, not replace any.

    If you want to replace the current DOM, try selecting the root node, and then doing a RootNode.parentNode.replaceChild()
Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.