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.