SAX2: LexicalHandler

David Megginson david at megginson.com
Wed Dec 22 14:31:43 GMT 1999


Just a quick review -- here's the LexicalHandler from SAX2 alpha,
modified so that the callbacks throw IOException rather than
SAXException:

  public interface LexicalHandler
  {
    public void startDTD (String name, String publicId, String systemId)
      throws IOException;
    public void endDTD () throws IOException;

    public void startEntity (String name) throws IOException;
    public void endEntity (String name) throws IOException;

    public void startCDATA () throws IOException;
    public void endCDATA () throws IOException;

    public void comment (char ch[], int start, int length)
      throws IOException;
  }

Notes:

1. start/endDTD refer to the start and end of the DOCTYPE declaration, 
   not to the start and end of the external DTD subset.  The
   parameters are those given in the DOCTYPE declaration (if present).

2. The start/endEntity callbacks provide the entity name, prefixed
   with '%' if it is a parameter entity, or the special names
   [document] for the document entity or [dtd] for the external DTD
   subset.

During the original design a few months back, we decided not to
provide the public and system identifiers in start/endEntity, because
that information would be available through the DeclHandler (which
I'll include in a following message).  Since both the LexicalHandler
and the DeclHandler are optional, however, I wonder if a little
redundancy would make sense:

    public void startEntity (String name, String publicId,
                             String systemId) throws IOException;
    public void endEntity (String name) throws IOException;

That way, if the parser supports the LexicalHandler but not the
DeclHandler, the public and system identifiers for entities will still 
be available.

Comments?


All the best,


David

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

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





More information about the Xml-dev mailing list