I'm not sure I follow what you're asking here.
using this property
What property? PreserveWhitespace
? For that particular property if you read the docs then it says it determines if the whitespace is preserved on loading and saving so yes it has an impact if set before you call Load
. If you don't set it then whitespace is thrown out when the document loads to save space. As such if you then try to write the document back out then all the whitespace has already been stripped out. However there is a difference between significant (which is always preserved and insignificant whitespace which is what the property controls. See here.
As far as HasChildNodes
is concerned it simply indicates whether a node has any children or not. It is slightly faster than going to the nodes themselves and would allow deferring of the load of the nodes. But it probably isn't useful to call it on the document (which inherits it from XmlNode
) because a document will have child nodes. An XML document isn't valid unless it has the XML declaration and root element, both of which are children. If Load
doesn't throw an exception then the document has children. Use the HasChildNodes
property on elements within the document as you're parsing it.