Re: [xml-dev] Re: why whitespace counts as a node?

From
Michael Kay <>
To
Date
2010-11-14T13:11:35Z
ID
<>
Thread
Re: [xml-dev] Re: why whitespace counts as a node?
> Ok, so it does serve a purpose.  However, even in xhtml, if you want
> white space in a paragraph of text, then you can put that whitespace
> between tags.  I'm sure it's my lack of experience, but, for example,
> when do you need that white space?
>
Once you accept the usefulness of inline markup like this:

<p>I just <i>love</i> <place>London</place></p>

then you have to accept that the space between "love" and "London" is 
just as significant as the one between "I" and "just".

Some of the XML specs do try and recognize that whitespace in mixed 
content needs to be treated differently from whitespace in "element-only 
content" (like database dumps). But part of the XML philosphy is that 
XML instances can be used without having a schema or DTD, which means 
you don't always know whether it's mixed content or not. So you have to 
treat it as significant.

This is one of the reasons it's best to avoid "non-standard" uses of 
mixed content like this:

<date-of-birth>
<source>birth-certificate</source>
   1920-03-04
</date-of-birth>

Michael Kay
Saxonica