|
[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: SAX2: relative ordering of startDocument() & startDTD() events?
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! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|
|||||||||

Cart








