问题描述
有人能告诉我如何使用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部分?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!