If your source data contains an "&", it will be converted to "&" and placed into your XML document. When you parse your XML document, the "&" will be converted back to a "&". However, you must use CDATA to store "&" as is:using System; using System.Collections.Generic; using System.Text; using System.Xml; namespace AmpXml { class Program { static void Main(string[] args) { XmlDocument doc = new XmlDocument(); XmlNode node = doc.CreateNode( XmlNodeType.Element, "amps", string.Empty); doc.AppendChild(node); node = doc.CreateNode( XmlNodeType.Element, "amp", string.Empty); doc.DocumentElement.AppendChild(node); XmlCDataSection cdata = doc.CreateCDataSection( "&&>>&&<<&&"); node.AppendChild(cdata); Console.WriteLine(doc.OuterXml); } } }
-- modified at 13:00 Saturday 27th May, 2006