Problems with whitespace and msxml

Chris Lovett clovett at microsoft.com
Fri Jan 2 18:12:34 GMT 1998


Ok, sorry it took so long to respond.  There are a number of problems I see
in your example:

1) The xml-space values are now lowercase, so you should have:
	xml-space (default|preserve) "default"

Or, you can also use namespaces instead and have "xml:space".

On the ATTLIST this says that it is valid to specify xml-space if you want
to.

2) Next you must also specify xml-space="preserve" on the instance that you
want whitespace preserved.  So for example:

	<bool xml-space="preserve">
		...

As for WHITESPACE nodes :- the other confusing issue here is that you are
talking about WHITESPACE nodes in the tree.  This is a whole different
subject.  These are ignorable whitespace nodes as defined in the XML DOM
spec (see DOM Working Group on www.w3.org for details).  These nodes are
always returned in the tree and are "ignorable".  The main reason for their
existance is so that the result of Document.save() looks very similar to the
original document that was loaded.

The only thing really affected by "preserve" is a PCDATA node.  When in the
scope of an element with the xml-space="preserve" attribute, the PCDATA node
will not normalize whitespace.

Hope this helps.

> -----Original Message-----
> From:	Alexander Hinds [SMTP:ahinds at poboxes.com]
> Sent:	Wednesday, December 31, 1997 2:55 PM
> To:	xml-dev at ic.ac.uk
> Subject:	Problems with whitespace and msxml
> 
> Forgive me if this has been discussed before, but I download the latest
> msxml.tar.gz from Microsoft's web site (release notes dated Dec 4) and am
> having a devil of a time with getting it to do the right thing with
> whitespace.
> 
> For one thing, despite what the docs say, it seems to insist on:
> 
> <!ATTLIST book
> 	xml-space	(DEFAULT | FIXED)	'DEFAULT'
> >
> 
> instead of "default | preserve".
> 
> 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.
> 
> Any help or suggestions would be most appreciated.  Thanks in advance.
> 
> ---book DTD---
> 
> <?xml version="1.0" ?>
> <!DOCTYPE book [
> 
> <!ENTITY % block "p | section">
> <!ENTITY % flow "#PCDATA | %block;">
> 
> <!ELEMENT book 	(section)+ >
> <!ELEMENT section 	(%flow;)* >
> <!ELEMENT p		(#PCDATA) >
> 
> <!ATTLIST book
> 	name		CDATA			#REQUIRED
> 	author		CDATA			#REQUIRED
> 	xml-space	(DEFAULT | FIXED)	'DEFAULT'
> >
> 
> <!ATTLIST section
> 	name		CDATA			#REQUIRED
> >
> 
> ]>
> 
> 
> xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
> Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
> To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
> (un)subscribe xml-dev
> To subscribe to the digests, mailto:majordomo at ic.ac.uk the following
> message;
> subscribe xml-dev-digest
> List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)

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




More information about the Xml-dev mailing list