tags:

views:

81

answers:

1

I need to search for certain nodes in an XML document, modify the InnerXML property of those nodes, and then write the changes out to the file.

I can search the nodes find using XPathDocument, XPathNavigator, etc... but any sort of writing using these classes doesn't seem to be supported.

Is there a way to pull a node out using the XPath stuff and then link that up to the standard XmlDocument classes so I can actually modify the file contents?

Thanks

Tom

+2  A: 

XmlDocument supports xpath...

XmlElement el = (XmlElement)doc.SelectSingleNode(somePath);
el.InnerXml = newInnerXml;
doc.Save(destination);

Did I miss something?

Marc Gravell
Nope. I apparently just fail at reading documentation. Thanks :)
cakeforcerberus