本文介绍了如何使用XPathNavigator插入CDATA部分?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人能告诉我如何使用XPathNavigator插入CDATA部分吗?我已经尝试过没有运气了:


XmlDocument docNav = new XmlDocument();

docNav.LoadXml(xmlString );

XPathNavigator nav = docNav.CreateNavigator();


XmlDocument doc = new XmlDocument();

doc.LoadXml ("< DocumentData>< / DocumentData>");

XmlElement elem = doc.CreateElement(currentNodeName);

elem.AppendChild(doc.CreateCDataSection( dataString));

doc.DocumentElement.AppendChild(elem);

XPathNavigator newNav = doc.CreateNavigator();


nav.InsertAfter(newNav);

问候,

Eric.-

解决方案









Can anybody show me how to insert a CDATA section using XPathNavigator ? I
have tried the follwing with no luck:

XmlDocument docNav = new XmlDocument();
docNav.LoadXml(xmlString);
XPathNavigator nav = docNav.CreateNavigator();

XmlDocument doc = new XmlDocument();
doc.LoadXml("<DocumentData></DocumentData>");
XmlElement elem = doc.CreateElement(currentNodeName);
elem.AppendChild(doc.CreateCDataSection(dataString ));
doc.DocumentElement.AppendChild(elem);
XPathNavigator newNav = doc.CreateNavigator();

nav.InsertAfter(newNav);
Regards,
Eric.-

解决方案









这篇关于如何使用XPathNavigator插入CDATA部分?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-12 18:47