[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: why whitespace counts as a node?

  • From: David Carlisle <davidc@nag.co.uk>
  • To: Thufir Hawat <hawat.thufir@gmail.com>
  • Date: Sat, 13 Nov 2010 11:54:20 +0000

Re:  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 
xsl:strip-space)

> 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?

yes

> 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
<row>
   <item>a</item>
   <item>b</item>
</row>

where all white space is cosmetic indentation.
>
>
> -Thufir
>
>
David


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


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.