Sure there is a way around it: StreamWriter sw = File.CreateText (@"C:\temp\out.xml"); sw.Write(doc.OuterXml.Replace("&", "&")); sw.Close();
This output of course is not valid XML. Unfortunately though, you can actually load this output document into an XMLDocument in .NET. But if you loaded this unvalid doc and then added another node to it and tried to save it off, the output is now hosed up. Take a look at the below snip: XmlDocument doc = new XmlDocument(); XmlNode docElem = doc.AppendChild (doc.CreateElement("DocElement")); docElem.AppendChild(doc.CreateElement ("SubElement")).InnerText = "ԵԽ"; XmlNode nd = doc.ChildNodes[0].ChildNodes[0]; StreamWriter sw = File.CreateText (@"C:\temp\out.xml"); sw.Write(doc.OuterXml.Replace("&", "&")); sw.Close(); XmlDocument doc2 = new XmlDocument(); doc2.Load(@"C:\temp\out.xml"); doc2.DocumentElement.AppendChild(doc2.CreateElement ("SubElement2")).InnerText = "ԵԽ"; doc2.Save(@"C:\temp\out2.xml"); Chad On Thu, 18 Mar 2004 09:31:26 +0100, Jeroen van den Bos (DT) <[EMAIL PROTECTED]> wrote: >Hi all, > >I'm reading data from a device and want to store the result in Xml. For >instance, I'd like to get this in my Xml output: > ><tag>ԵԽ</tag> > >If I write this to the InnerText of a "tag"-XmlElement, the &-characters >get translated to &. Is there any way around this? > >Thanks for any help! >-Jeroen > >=================================== >This list is hosted by DevelopMentorŪ http://www.develop.com >Some .NET courses you may be interested in: > >NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles >http://www.develop.com/courses/gaspdotnetls > >View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentorŪ http://www.develop.com Some .NET courses you may be interested in: NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles http://www.develop.com/courses/gaspdotnetls View archives and manage your subscription(s) at http://discuss.develop.com