I have these rather large strings that contain several linebreaks "\r\n" and, in some occasions I may even have sequences of linebreaks "\r\n\r\n...". This results in empty lines, which I do want to preserve upon loading the string into a XmlDocument object via LoadXml().
By default, empty lines are removed.
I've managed to find a way to keep those blank lines by using XDocument, but I still want to check if there is a way to do that with XmlDocument exclusively (so as to avoid to refactor big chunks of my code that rely in XmlDocument)
Use the
XmlDocument.PreserveWhitespacePropertyhttps://learn.microsoft.com/en-us/dotnet/api/system.xml.xmldocument.preservewhitespace?view=net-8.0