silentthread2k
asked on
Modify CDATA attribute in XmlDocument without using Navigator or XPath
The code below works if I want to modify the information inside the tag, but how do I modify the CDATA for what looks to be an attribute?
I want to modify "DocInfo" CDATA, but can't seem to find the correct expression to place into SelectSingleNode function.
(see below code and sample input xml.)
using System.Xml;
XmlDocument xmldoc = new XmlDocument();
xmldoc.Load(xmlfilepath);
xmldoc.SelectSingleNode("D ocument/Do cumentName ").InnerTe xt = "test";
<?xml version="1.0" encoding="utf-8" ?>
<Document>
<DocumentName><![CDATA[]]> </Document Name>
<IndexCollection>
<Index columnname="DocInfo"><![CD ATA[]]></I ndex>
<Index columnname="Somethingelse" ><![CDATA[ ]]></Index >
</IndexCollection>
</Document>
I want to modify "DocInfo" CDATA, but can't seem to find the correct expression to place into SelectSingleNode function.
(see below code and sample input xml.)
using System.Xml;
XmlDocument xmldoc = new XmlDocument();
xmldoc.Load(xmlfilepath);
xmldoc.SelectSingleNode("D
<?xml version="1.0" encoding="utf-8" ?>
<Document>
<DocumentName><![CDATA[]]>
<IndexCollection>
<Index columnname="DocInfo"><![CD
<Index columnname="Somethingelse"
</IndexCollection>
</Document>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.