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

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: Refactoring SAX 1.0

[ Lists Home | Date Index | Thread Index ]
  • From: andyclar@us.ibm.com
  • To: David Brownell <db@eng.sun.com>
  • Date: Thu, 8 Apr 1999 18:17:23 -0600



David,

David Brownell wrote:
> I'm still unclear on what you're suggesting ... suspect I'm
> not alone in it!  Do you have an example, maybe?
>
> Remember that compatibility is a ground rule for everyone.

Yes, I've been thinking a lot about this recently and have
come up with an example of how the SAX 1.0 could be refactored.

First, I looked at the SAX interfaces and classes that are of
general use to all parsers. My list includes the following:

  org.xml.sax.EntityResolver
  org.xml.sax.ErrorHandler
  org.xml.sax.InputSource
  org.xml.sax.Locator
  org.xml.sax.Parser
  org.xml.sax.SAXException
  org.xml.sax.SAXParseException

The EntityResolver, InputSource, and Locator objects can be
used without modification. Because general error handling is
useful to all parsers, I would rename SAXException to
XMLException and do the same for SAXParseException. These
name changes would affect the ErrorHandler callback methods.

I would keep the Parser interface the same except for
removing the callback registration methods (setDTDHandler
and setDocumentHandler) that are specific to a stream based
parser. To enable the stream based parsing functionality, I
would add a SAXParser interface that extends the new Parser
interface to add the callback registration methods.

(I'm not including code examples of what these new interfaces
and classes look like in order to keep this posting short. But
I could post further if there was interest.)

I realize that compatability with SAX 1.0 is very important
to retain. I would suggest keeping the org.xml.sax and
org.xml.sax.helpers packages the same -- don't change them
at all. Nothing would be moved or renamed. In this way,
users of SAX 1.0 would not have to change their code.

The refactored SAX could be moved to new packages. For
example, org.xml and org.xml.sax2. The org.xml package would
contain all of the general purpose interfaces and objects
and org.xml.sax2 would contain the specific SAX objects. The
latter would include all of the SAX2 extensions being
discussed now on the mailing list, as well.

--
Andy Clark * IBM, JTC - Silicon Valley * andyclar@us.ibm.com



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





 

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

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