Simplified, I have a an XML like that:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?><root> <data> </data></root>
As you can see, there is space after the root entry tag and a space in the data tag. When I now use it like this:
var xmldoc = new XmlDocument();
xmldoc.Load(stream);
... the document looses both spaces, the one after root entry tag and the one in the data tag.
But If I use it like this:
var xmldoc = new XmlDocument();
xmldoc.PreserveWhitespace = true;
xmldoc.Load(stream);
... then both spaces are preserved.
But according to the documentation (documentation, remarks section), the setting PreserveWhitespace = false, which is default, should keep significant white spaces and get rid of not significant ones. But it cleanes all of them, and the one in data tag is significant. Or do I understand something wrong here?