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

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

  • From: David Brownell <david-b@p...>
  • To: Michael Fuller <msf@i...>
  • Date: Tue, 08 Feb 2000 19:00:03 -0800

sun tr2 parser
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

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.