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

RE: Handling of significant whitespace in .NET XmlReader


significantwhitespace
Derek,

> The only way to identify that whitespace is 'significant' is 
> 1) look ahead, possibly all the way to the end element, to 
> look for sibling text which is not whitespace.  This is 
> prohibitively expensive, since it may mean caching almost the 
> entire document.
> 2) having a DTD/Schema which identifies the content as text or mixed.
> 
> Since (1) is prohibitively expensive, the only viable option 
> is (2).  And indeed, if you use the XmlValidatingReader and 
> have a DTD/XSD which identifies the content as mixed, you 
> will get back SignificantWhitespace, rather than just 
> Whitespace.  (I think... I looked at the code, but didn't 
> actually code up a sample, and thus could be wrong.  It is 
> obvious that the intent of the code is to do this, so a 
> failure to report SignificantWhitespace in such contexts is a bug.)

True if you want to find out whether the content is mixed or not in a
wellformed document you'll have to read to the end of the element and that's
prohibitive expensive. But there's no need to find out whether the element
has mixed content or not, as in wellformed documents the first whitespace
after a node must be significant otherwise you cannot quarantee to preserve
the semantic meaning of the document during the parsing process (i.e. you
act as a filter instead of a pipe). Or as Norman Walsh just said:

<quote>Without a DTD, all content is mixed.</quote>

Regards

Axel

PS: We cannot use a DTD as we haven't got one and the production of a DTD is
... See (1) ... ;-)

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.