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

Re: SAX and ignorableWhitespace


sax ignorablewhitespace

Hi Elliotte,

Thanks for answering...

> The word "ignorable" is an
> unfortunate choice here. It means the application receiving the data
> may choose to ignore it. However, the parser cannot ignore this
> content. It must provide it.

I am willing to take that on faith, but just for the sake of throroughness,
my question is more "why must it provide it". It seems that the same
argument could be made for element and attribute declarations. Clearly the
parser cannot ignore them, yet it is not required that the information be
passed in one of the default interfaces-- they are only reported through the
DeclHandler, an extension interface. So there is a precedent for the parser
"not ignoring" a section of the document, yet simultaneously "not providing"
it.

> White space is only really ignorable if
> there's a DTD, and even then you may choose not to ignore it.

Point taken, but can't you also argue that ignorableWhitespace should never
be called without a DTD. So the case where there is no DTD is moot, all
character information would be reported through the characters function. In
which case the analogous elementDecl, attributeDecl and the like seem to
verify that it could safely be relegated to an extension interface.

IIRC, the SAX interface set predates the Infoset spec, so any mandate to
provide specific information to the application must have come from
somewhere else. The following wording in the XML spec seems to be the
source:

"In editing XML documents, it is often convenient to use "white space"
(spaces, tabs, and blank lines) to set apart the markup for greater
readability. Such white space is typically not intended for inclusion in the
delivered version of the document. On the other hand, "significant" white
space that should be preserved in the delivered version is common, for
example in poetry and source code.

An XML processor must always pass all characters in a document that are not
markup through to the application. A validating XML processor must also
inform the application which of these characters constitute white space
appearing in element content." [1]

Of course, reporting through the extensions is still viable. But the wording
in the spec is pretty convincing. Can anyone confirm that this is indeed why
the ignorableWhitespace function is found within the ContentHandler. Maybe
my question was why this statement was included in the XML specification to
begin with...

[1] http://www.w3.org/TR/REC-xml.html#sec-white-space


Hungry for answers,
Jeff Rafter


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.