Xml: Modifying and saving Xml document problem.

  • Thread starter Thread starter Guest
  • Start date Start date
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,
 
Back
Top