Xml: Modifying and saving Xml document problem.

G

Guest

Hi there,

I load an Xml document into an XmlDocument object. I look up some nodes
using SelectNodes/SelectSingleNode, and I modify the InnerText property.
After this I call the XmlDocument.Save method on the XmlDocument object, BUT,
the changes are NOT written! The resulting Xml document is identical to the
original.

Basically what I do is this:

XmlDocument xDoc = new XmlDocument();
xDoc.Load( xmlFileName );
// modify nodes found by SelectNodes/SelectSingleNode
xDoc.Save( xmlAnotherFileName );

The contents of xmlFileName file and xmlAnotherFileName file are identical,
even though I changed some nodes' InnerText property.

Is this normal? What can I be doing wrong if it isn't?

Thanks,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top