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


Help: OASIS Mailing Lists Help | MarkMail Help



   SAX2 RFD: LexicalHandler draft v.1.1

[ Lists Home | Date Index | Thread Index ]
  • From: David Megginson <david@megginson.com>
  • To: "XML Developers' List" <xml-dev@ic.ac.uk>
  • Date: Sat, 20 Mar 1999 21:58:54 -0500 (EST)

Now that we have the name down pat and a good idea of how we'll be
setting up SAX2 (including the core features, properties, and extended 
handlers), it's time to dive into the details.

We discussed the lexical handler before, but I have lost my earlier
drafts, so I've reinvented it from memory -- sincere apologies to
anyone whose brillian suggestions I have lost.

This handler has the handerID http://xml.org/sax/handlers/lexical, and
you would set it like this:

  try {
    parser.setHandler("http://xml.org/sax/handlers/lexical", handler);
  } catch (SAXNotSupportedException e) {
    // do something clever ...

I've included some additional details after the interface.  Note that
this interface (and all other new SAX2 interfaces) will be optional -- 
a parser will not have to implement it for SAX conformance, and may
choose to use only parts of it even if it does implement it (it might
report comments but not CDATA section boundaries, for example) as long 
as it does report matching start/end pairs.

// LexicalHandler.java
// $Id: LexicalHandler.java,v 1.1 1999/03/21 02:49:41 david Exp $
// SAX2 handlerID: http://xml.org/sax/handlers/lexical

package org.xml.sax;

public interface LexicalHandler
    public abstract void xmlDecl (String version,
				  String encoding,
				  String standalone)
	throws SAXException;

    public abstract void startDTD (String doctype,
				   String publicID,
				   String systemID)
	throws SAXException;

    public abstract void endDTD ()
	throws SAXException;

    public abstract void startEntity (String name)
	throws SAXException;

    public abstract void endEntity (String name)
	throws SAXException;

    public abstract void comment (String text)
	throws SAXException;

    public abstract void startCDATA ()
	throws SAXException;

    public abstract void endCDATA ()
	throws SAXException;

// end of LexicalHandler.java


1. The startDTD() and endDTD() methods surround everything within the
   DOCTYPE declaration, including the internal and external subsets
   and any declarations, comments, PI's, etc. within.

2. The startEntity() method will be used for the external DTD subset
   (if the parser reads it), with the pseudo-entity name '[dtd]'.

Now, is this overkill?  Do we really need to know about CDATA sections 
and the XML declaration?  Comments, please.

Thanks, and all the best,


David Megginson                 david@megginson.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