SAX: ModSAX addition, general property query

David Megginson david at
Mon Mar 8 11:51:31 GMT 1999

What: Additions to ModParser interface

I'm proposing a couple of additions to the ModParser interface:

  public interface ModParser extends Parser
    public abstract void setFeature (String featureID, boolean state)
      throws SAXNotSupportedException;

    public abstract void setHandler (String handlerID, ModHandler handler)
      throws SAXNotSupportedException;

    public abstract void set (String infoID, Object prop)
      throws SAXNotSupportedException;

    public abstract Object get (String infoID)
      throws SAXNotSupportedException;

These allow you to do interesting things like

  parser.set("", filter);


  try {
    Node node = parser.get("");
  } catch (SAXNotRecognizedException e1) {
    // doesn't know about DOM processing...
  } catch (SAXNotSupportedException e2) {
    // knows about DOM processing, but not doing it...

Again, it's a little sloppy as an interface, but it's beautifully
extensible and it supports filters nicely (if there are other filters
between the DOM iterator and the application, it will still work).

Note that strictly speaking, now, setHandler() and setFeature() are no
longer primitives, since they could both be implemented in terms of
set(), but I think that the extra type checking is worthwhile in those 

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