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

Re: SAX2: LexicalHandler

  • From: David Brownell <david-b@p...>
  • To: David Megginson <david@m...>
  • Date: Wed, 22 Dec 1999 08:06:03 -0800

lexicalhandler
David Megginson wrote:
> 
> Just a quick review -- here's the LexicalHandler from SAX2 alpha,
> modified so that the callbacks throw IOException rather than
> SAXException:

[ again, overloading IOException seems quite wrong to me ]


>     public void startDTD (String name, String publicId, String systemId)
>       throws IOException;

The "name" is a declaration, affecting validity, and belongs
with other DTD declarations.  Else parsers that expose the rest
of the DTD declarations, but not lexical events, can't support
the full set of validity checks in application code.

For DOM Level 2 support, the literal text of the internal subset
needs to be provided.


>     public void startEntity (String name) throws IOException;
>     public void endEntity (String name) throws IOException;

A bunch of restrictions to this were identified as being essential,
such as the fact that entities expanded within other constructs
mustn't be exposed.  For example:

	<!ATTLIST foo %std-attrs; %i18n-attrs; %gooey-attrs;>

	<element foo="&entity1;" bar="&entity2;" />

I'm hoping the full spec for those callbacks makes clear that
in such situations the entities MUST NOT be reported.  (And
would strongly prefer that parameter entities never show up
in any context whatsoever.)

The reason was briefly that applications can't see inside the
structure of those constructs -- they'll just see some start/end
entity calls, FOLLOWED (oops!) by the callback of which they're
a part.  Just like they would if the entities preceded that
construct.


>	 I wonder if a little
> redundancy would make sense:
> 
>     public void startEntity (String name, String publicId,
>                              String systemId) throws IOException;
>     public void endEntity (String name) throws IOException;
> 
> That way, if the parser supports the LexicalHandler but not the
> DeclHandler, the public and system identifiers for entities will still
> be available.

That wouldn't handle internal entities, though.

I have fundamental issues with the notion of exposing the entity
structure of documents beyond that needed to recreate the DOCTYPE
declaration (DTD).  Not just in SAX; DOM does it pretty poorly too
(children of entity refs must be readonly, making them impossible
to manipulate in typical ways).

So I'd really rather not see that particular thing done ... if
any substantial change is to be made to entity reporting, my vote
is to just drop it entirely.  It's too messy a notion (IMHO) to
show up in any API offering higher level notions than lexical
tokens. (angle bracket, name, space, name token, space, equals,
double quote, text, entity ref, text, double quote, angle bracket,
text ... you get the idea.)

- Dave

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i...
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo@i... the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo@i... the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@i...)



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.