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

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   SAX2 Event Sequence [Was: Re: SAX2: relative ordering of startDocument()

[ Lists Home | Date Index | Thread Index ]
  • From: David Megginson <david@megginson.com>
  • To: XML-DEV <xml-dev@xml.org>
  • Date: Fri, 3 Mar 2000 12:06:53 -0500 (EST)

Michael Fuller writes:

 > [As promised sometime ago, a summary of the SAX2 event sequence.]
 > 
 > Mixing all possible events in from ContentHandler, DTDHandler,
 > LexicalHandler, and DeclHandler, the legal event sequence appears to be:

 [snip]

Here's my take on it right now:

1. ContentHandler.setLocator is always the first event if it appears
   at all.

2. With the exception of #1, the first event will always be
   ContentHandler.startDocument, and, assuming normal termination,
   the last event will always be ContentHandler.endDocument.

3. The remaining events in ContentHandler and LexicalHandler (if used) 
   appear in document order (depth-first, if you're thinking of a
   tree).

4. The events for DTDHandler and DeclHandler are not required to
   appear in document order, but they must follow certain constraints:

   4a. All DTDHandler and DeclHandler events must be reported after
       the ContentHandler.startDocument event and before the first
       ContentHandler.startElement event.

   4b. If a LexicalHandler is in use, the LexicalHandler.startDTD
       event will appear before all DTDHandler and DeclHandler
       events, and the LexicalHandler.endDTD event will appear after
       all DTDHandler and DeclHandler events.

   4c. If a LexicalHandler is in use, all DTDHandler and DeclHandler
       events must appear within the start/endEntity events for the
       entity in which they appear.

   4d. It is not necessary otherwise to preserve the relative ordering
       of DTDHandler and DeclHandler events with 
       ContentHandler.processingInstruction and LexicalHandler.comment
       events.

That may seem confusing, but that's only because I'm trying to be
fairly (and uncharacteristically) precise.  I'm reluctant to constrain 
implementors excessively, and I want to make it especially easy for
SAXDrivers that don't implement LexicalHandler at all (they can just
dump the DTDHandler events from their internal tables when they're
ready to report the first ContentHandler.startElement event).

This should all be part of a formal, language-independent SAX2 spec.
Any tech writers willing to volunteer to help out?  To edit?  To
co-ordinate?  I'm afraid that it's beyond my personal resources to
write that right now, though I'd be happy to review it, and bless it
(in nomine...) when xml-devvers think it's ready for prime time.


All the best,


David

-- 
David Megginson                 david@megginson.com
           http://www.megginson.com/

***************************************************************************
This is xml-dev, the mailing list for XML developers.
To unsubscribe, mailto:majordomo@xml.org&BODY=unsubscribe%20xml-dev
List archives are available at http://xml.org/archives/xml-dev/
***************************************************************************




 

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

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