OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] why whitespace counts as a node?

On 13/11/2010 10:29, Thufir Hawat wrote:
> When parsed, why is whitespace counted as a node?  It might just be my
> Java bias, but I would greatly prefer the idea of a Tree mapping 1-1 to
> XML.  However, with whitespace counting, then the resulting XML text file
> all mushed together.
> At least that's my understanding.  When parsing XML the parser must
> determine whether or not interpret whitespace as a node or not,

No it must always report it. (Applications may choose to ignore it (cf 

> so that
> different parsers will give different results.
No the behaviour is specified (msxml rather famously ignores the 
specification ignoring white space by default, causing all sorts of 
problems with inter word spaces vanishing)

  Shouldn't the goal be for
> their to be a single correct representation for a given document?


> So
> long as whitespace counts, then it depends upon the parser to either
> include or not include the whitespace.
> Is the choice to have whitespace count perceived of as design flaw, or
> does it server a purpose?

If you have <b>this</b> <i>or</i> <b>this</b>  and you throw away white 
space text nodes then you throw away inter word spaces (as can easily be 
seen if you view xml in internet explorer). Not all XML is a database dump

where all white space is cosmetic indentation.
> -Thufir

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS