28 Mar
2005

xml:space=”preserve”

I must first admit that this is not my find, it is credited to one of my team members,
but I thought it peculiar enough to mention here.

When applying the xml:space=”preserve” attribute
in an XML instance, it causes the DOM that loads the document to behave accordingly
(mostly). If the XML is loaded and then saved via XmlDocument.Save(string) the whitespace
in the document is indeed preserved, but the XmlDocument.PreserveWhitespace property
continues to return false while the COM is in memory.  Weird.

I should point out that this behavior is seen in the 1.1 framework.  Any suggestions
on what is going on here?