Appending a node to an existing xml file in C#
You have worked with XML technologies for appending a node to an existing xml files.You are aware of the considerations when dealing with “Special” characters. This recently came up at my work, so i am going to share my few thoughts.?
One of the programmers was doing an Appending a node to an existing xml file using C# (ASP.NET). We are use to add node like ?
Example below:
newNode.InnerXML = “<Option Name=’FileRead’>1</Option>”;
newNode.InnerXML = “<Option Name=’FileWrite>1</Option>”;?
But this node has invalid characters.?
Now you know that the above example have invalid characters.?
The “<”,”>” isn’t allowed with a node’s text.?
Instead of above code we should be use this way.
? xn.InnerXml += “<Option Name=’FileRead’>1</Option>”;?
xn.InnerXml += “<Option Name=’FileWrite>1</Option>”;