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

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: SAX2: relative ordering of startDocument() & startDTD() events?

[ Lists Home | Date Index | Thread Index ]
  • From: David Brownell <david-b@pacbell.net>
  • To: Michael Fuller <msf@io.mds.rmit.edu.au>
  • Date: Tue, 08 Feb 2000 19:00:03 -0800

Michael Fuller wrote:
> 
> Anyway, nothing complex: just an itemization of events, order, and meaning.
> Less of a White Paper, more of a Memo. :-)
> (If I get a chance, I'll whip up a draft.)

If you're also implementing these ... I'm wondering your thoughts
about the DeclHandler.  I now see three separate parse orders
(other implementations may see more).  Using this simple document

	<!DOCTYPE foo [
	<?pi precedes related element?>
	<!ELEMENT foo EMPTY>
	<!-- comment follows -->
	] <foo/>

Those three orders would be

	- Lexical order.  (My SAX2 wrapper of Sun's TR2 parser.)

	  setDocumentLocator (l)
	  startDocument ()
	    startDTD ("foo", null, null);
	      processingInstruction ("pi", "precedes related element")
	      elementDecl ("foo", "EMPTY")
	      comment ("comment follows" in buf/off/len format)
	    endDtd
	    startElement ("foo", null)	/* null, empty, whatever */
	    endElement ("foo")
	  endDocument ()

	- DOM order.  (My DOM parser, showing all DOM can show)

	  // locator is nonsensical, not provide
	  startDocument ()
	    startDTD ("foo", null, null);
	      // PIs in DTD are discarded
	      // element/attribute data type info in DTD is discarded
	      // comments in DTD are discarded
	    endDtd
	    startElement ("foo", null)	// null, empty, whatever
	    endElement ("foo")
	  endDocument ()

	- AElfred order.  (My SAX2 enhanced version.)

	  setDocumentLocator (l)
	  startDocument ()
	    startDTD ("foo", null, null);
	      processingInstruction ("pi", "precedes related element")
	      comment ("comment follows" in buf/off/len format)
	      elementDecl ("foo", "EMPTY")
	    endDtd
	    startElement ("foo", null)	/* null, empty, whatever */
	    endElement ("foo")
	  endDocument ()

I'd propose that the lexical order be the order that all SAX2 processors
must follow.

Should it be legal for a parser to support the decl handler without also
implementing the lexical handler?  I'd think the answer should be yes, but
then one declaration ("root element is ...") wouldn't be available.

- Dave




 

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

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