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] SAX and ignorableWhitespace

[ Lists Home | Date Index | Thread Index ]


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





 

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

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