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

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   RE: [xml-dev] Handling of significant whitespace in .NET XmlReader

[ Lists Home | Date Index | Thread Index ]

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) ... ;-)




 

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

Copyright 2001 XML.org. This site is hosted by OASIS