SAX2: Another thought on subtyping, modification, etc.

David Megginson david at
Fri May 21 17:04:18 BST 1999

There have been many good suggestions on this thread about how to
proceed with SAX2 (modification vs. subtyping vs. separate
interfaces).  I was thinking about this problem last night, and it
occurred to me that the ability to query and set features and
properties might be useful not only for parsers but also for handlers, 
and perhaps for specialised data structures of some sort.  If that's
the case, then a separate interface makes a lot of sense:

  package org.xml.sax;

  public interface Configurable
    public abstract void setFeature (String featureId, boolean state)
      throws SAXException;

    public abstract boolean getFeature (String featureId)
      throws SAXException;

    public abstract void setProperty (String propertyId, Object value)
      throws SAXException;

    public abstract Object getProperty (String propertyId)
      throws SAXException;

In addition to filters, I can imagine general-purpose DocumentHandlers
(etc.) for things like writing XML, populating a database, etc., and
there might be value in allowing an application to query them as well.

To make life easier (and to save casting), we could also extend
Parser, etc. if people wanted to:

  public interface ConfigurableParser
    extends Parser, Configurable

  public interface ConfigurableDocumentHandler
    extends DocumentHandler, Configurable


All the best,


David Megginson                 david at

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

More information about the Xml-dev mailing list