I am trying to add a comment to an existing XML document. The document, when opened in an XML reader (I use notepad++), is formatted perfectly. However, when I run it through my code that simply adds a comment to the top the XML comes out as one long line. In other words, all the line breaks have been removed. How to I maintain my line breaks?
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(doc.Uri);
//This is where I add comments to a string
xmlDoc.DocumentElement.PrependChild(enrichedDoc.CreateComment(comments));
return xmlDoc;
That should do the trick.