troubleshooting Question

Modify CDATA attribute in XmlDocument without using Navigator or XPath

Avatar of silentthread2k
silentthread2kFlag for United States of America asked on
XML.NET Programming
1 Comment1 Solution529 ViewsLast Modified:
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.SelectSingleNode("Document/DocumentName").InnerText = "test";

<?xml version="1.0" encoding="utf-8" ?>
    <Index columnname="DocInfo"><![CDATA[]]></Index>
    <Index columnname="Somethingelse"><![CDATA[]]></Index>
Join our community to see this answer!
Unlock 1 Answer and 1 Comment.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros