error while copying xml from secondary to main DOM - InfoPath Dev
in

InfoPath Dev

error while copying xml from secondary to main DOM

Last post 02-02-2010 06:10 AM by vikas_chess. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 01-21-2010 06:18 AM

    error while copying xml from secondary to main DOM

    I am getting following error while writing code in Jscript to copy xml from secondary to main DOM:

     

    Element '{http://schemas.microsoft.com/office/infopath/2003/myXSD/2008-06-03T00:09:57}List' is unexpected according to content model of parent element '{http://schemas.microsoft.com/office/infopath/2003/myXSD/2010-01-20T15:52:17}MyFields'

     

    below is the JScript code:

    function load::OnClick(eventObj)

    {

    var secondaryApes = XDocument.GetDOM("apes").selectNodes("/Main/List");

    var mainRoot = XDocument.DOM.selectSingleNode("/my:myFields");

    var apes;

    while(apes = secondaryApes.nextNode()) {

    var qNo = apes.selectSingleNode("QNo").text;

    var question = apes.selectSingleNode("Question").text;

    var apesXML = "<my:List xmlns:my='http://schemas.microsoft.com/office/infopath/2003/myXSD/2008-06-03T00:09:57'>"

    + "<my:QNo>" + qNo + "</my:QNo>"

    + "<my:Question>" + question + "</my:Question></my:List>";

    // Load new apes string into a temporary XML DOM.

    var domNewRow = XDocument.CreateDOM();

    domNewRow.validateOnParse = false;

    domNewRow.async = false;

    domNewRow.loadXML(apesXML);

    domNewRow.setProperty("SelectionNamespaces", 'xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2008-06-03T00:09:57"');

     

    // Insert the new a into the main DOM.

    var lst = domNewRow.selectSingleNode("my:List");

    mainRoot.appendChild(lst);

    }

    }

     

    getting error at last line: mainRoot.appendChild(lst);

    Please tell me how to resolve the error.

     

    thank you.

  • 01-21-2010 06:44 AM In reply to

    Re: error while copying xml from secondary to main DOM

    Does your main data source have a my:List node directly under the my:myFields node, whose namespace is different from the myFields namespace?  You need to put your data into nodes that are defined in the structure of your main data source.
    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 01-21-2010 07:14 AM In reply to

    Re: error while copying xml from secondary to main DOM

    thank you. there was problem with my resource structure.

  • 02-02-2010 06:10 AM In reply to

    Re: error while copying xml from secondary to main DOM

    I have created the main data source from secondary data source. Now, how could i add a control (say comments text box) inside the List repeating field of main control? I am getting error while doing so. please suggest.

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