Problems with whitespace and msxml

David Megginson ak117 at
Thu Jan 1 13:47:35 GMT 1998

Alexander Hinds writes:

[on xml:space]

 > Moreover, no matter what I set it to, I always get back whitespace
 > in my tree, even without a mixed content model (for example, for
 > element book, it's first sib is always whitespace).
 >  My question, basically is: how do I eliminate whitespace from my
 > tree entirely?  Or failing that how do I get the current value of
 > xml-space in my ElementImpl subclass?  It appears that nameXMLSPACE
 > is private, not protected (why?) so a subclass can't really search
 > it.  But even when I change the visibility, it's always null
 > anyway.

I have not used msxml recently, so I do not know what it does, but the
PR is very clear that the 'xml:space' attribute is strictly
informative (from 2.10, "White Space Handling"):

   An XML processor must always pass all characters in a document that
   are not markup through to the application. A validating XML processor
   must distinguish white space in element content from other non-markup
   characters and signal to the application that white space in element
   content is not significant.

   A special attribute named "xml:space" may be inserted in documents to
   signal an intention that the element to which this attribute applies
   requires all white space to be treated as significant by applications.

In other words, the value of xml:space should _not_ affect the
information that msxml returns to your application; instead, it is up
to your application to read the value, if present, and to take
appropriate action.  Msxml should return all whitespace, no matter

I have heard rumours that xml:space may some day be removed from the
core XML spec and put into a separate "XML Conventions" spec -- that
would be a very good idea.

All the best,


David Megginson                 ak117 at
Microstar Software Ltd.         dmeggins at

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at
Archived as:
To (un)subscribe, mailto:majordomo at the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at

More information about the Xml-dev mailing list