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