I have an XMLDocument that I read from a file. The file is Unicode and has a newline character '\ n'. When I write XMLDocument output, it has the newline characters '\ r \ n'.
Here is the code, quite simple:
XmlTextWriter writer = new XmlTextWriter(indexFile + ".tmp", System.Text.UnicodeEncoding.Unicode); writer.Formatting = Formatting.Indented; doc.WriteTo(writer); writer.Close();
XmlWriterSettings has the NewLineChars property, but I cannot specify the parameter parameter in 'writer', it is read-only.
I can create an XmlWriter with the specified XmlWriterSettings property, but XmlWriter does not have a formatting property, leaving the file without any line breaks.
So, in short, I need to write a Unicode Xml file with the newline character '\ n' and Formatting.Indented. Thoughts?
c # newline xmldocument xmlwriter
jaws
source share