插入group节点时,发生异常“is unexpected according to content model of parent element“
来源:互联网 发布:小班亲子美工 编辑:程序博客网 时间:2024/04/29 11:38
我在插入一个group节点时,发生了如下的异常
Message "Element '{http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-04-11T09:28:40}Contacts' is unexpected according to content model of parent element '{http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-04-11T09:28:40}myFields'./r/nExpecting: {http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-04-11T09:28:40}Resources./r/n" string
下面是我的代码:
IXMLDOMNode nodeEntry, node;
//set the projectid
IXMLDOMDocument2 tempDom = (IXMLDOMDocument2)thisXDocument.DOM;
tempDom.setProperty("SelectionLanguage", "XPath");
tempDom.setProperty("SelectionNamespaces",
"xmlns:dfs=/"" + "http://schemas.microsoft.com/office/infopath/2003/dataFormSolution" +
"/" xmlns:my=/"http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-04-11T09:28:40/"");
//nodeEntry = tempDom.documentElement.selectSingleNode("my:Tasks");
//node = nodeEntry.cloneNode(true);
//nodeEntry.parentNode.appendChild(node);
try
{
nodeEntry = tempDom.documentElement.selectSingleNode("my:Contacts");
node = nodeEntry.cloneNode(true);
nodeEntry.parentNode.appendChild(node);
}
catch (Exception ex)
{
}
马上在网上找了一下,没有找到具体的原因,不过可以肯定是因为我们在设计infopath时对group node做过某些修改造成的。
解决方法很简单,使用insertBefore代替appendChild即可。
// Write your code here.
IXMLDOMNode nodeEntry, node;
//set the projectid
IXMLDOMDocument2 tempDom = (IXMLDOMDocument2)thisXDocument.DOM;
tempDom.setProperty("SelectionLanguage", "XPath");
tempDom.setProperty("SelectionNamespaces",
"xmlns:dfs=/"" + "http://schemas.microsoft.com/office/infopath/2003/dataFormSolution" +
"/" xmlns:my=/"http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-04-11T09:28:40/"");
//nodeEntry = tempDom.documentElement.selectSingleNode("my:Tasks");
//node = nodeEntry.cloneNode(true);
//nodeEntry.parentNode.appendChild(node);
try
{
nodeEntry = tempDom.documentElement.selectSingleNode("my:Contacts");
node = nodeEntry.cloneNode(true);
nodeEntry.parentNode.insertBefore(node, nodeEntry);
}
catch (Exception ex)
{
}
- 插入group节点时,发生异常“is unexpected according to content model of parent element“
- javascript错误解决:Unable to modify the parent container element before the child element is closed
- HTML Parsing Error: Unable to modify the parent container element before the child element is closed
- IE8报错:Unable to modify the parent container element before the child element is closed
- HTML Parsing Error:Unable to modify the parent container element before the child element is closed
- HTML Parsing Error: Unable to modify the parent container element before the child element is closed
- 异常:According to TLD tag beanwrite must be empty but is not
- According to the TLD or the tag file, attribute test is mandatory for tag if异常
- Switch view in the InfoPath form according to the whether current user is in SharePoint group admin
- hadoop 关闭datanode节点时发生异常:no datanode to stop
- IE 8 HTML Parsing Error: Unable to modify the parent container element before the child element is closed (KB927917)
- IE 8 HTML Parsing Error: Unable to modify the parent container element before the child element is closed (KB927917)
- IE 8 HTML Parsing Error: Unable to modify the parent container element before the child element is closed (KB927917)
- HTML Parsing Error: Unable to modify the parent container element before the child element is closed (KB927917)
- IE 8 HTML Parsing Error:Unable to modify the parent container element before the child element is cl
- IE 8 HTML Parsing Error:Unable to modify the parent container element before the child element is cl
- IE 8 HTML Parsing Error: Unable to modify the parent container element before the child element is c
- IE8 中"HTML Parsing Error:Unable to modify the parent container element before the child element is c
- 有感而发与无病呻吟
- 胡牌判断函数
- 畅想2010年的IT职业 将分成四个领域
- 了解如何选择无线加密的方法
- 一个外企财务总监的一点建议
- 插入group节点时,发生异常“is unexpected according to content model of parent element“
- 职业生涯的12个最致命想法
- 15款最好的Windows安全检测工具
- 10年跳槽经验总结
- 轻松编写您自己的拖拉机算法,进行算法大战
- 毕业设计(二十三)- 以前在金堆里淘金,现在却只能在垃圾堆里寻“宝”了!
- 辞职前须慎重考虑的3个问题和3重境界
- 比尔·盖茨的人际关系法则
- IT人士之成功之6大步骤