SAX2: Another thought on subtyping, modification, etc.

David Megginson david at megginson.com
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
  {
  }

etc.


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 (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe 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