SAX: ModSAX addition, general property query

MikeDacon at aol.com MikeDacon at aol.com
Mon Mar 8 14:54:21 GMT 1999


Hi David,

In a message dated 3/8/99 9:10:40 AM Eastern Standard Time,
david at megginson.com writes:
> 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("http://www.foo.com/props/textfilter", filter);
>  
>  or
>  
>    try {
>      Node node = parser.get("http://xml.org/sax/props/dom-node");
>    } catch (SAXNotRecognizedException e1) {
>      // doesn't know about DOM processing...
>    } catch (SAXNotSupportedException e2) {
>      // knows about DOM processing, but not doing it...
>    }
>  

I think the success of a general set() and get() capability will
be based on the creation of a good initial set of descriptors (what you
called infoID) to get or set.

So, in that vein, I have 2 comments:

1. I still strongly urge not to use a URI for a feature or infoID.  These are
not resource locations they are just a descriptive string.  In fact, I 
bet that most parsers just implement your initial recommended set.

2. I'd recommend that constants be defined in the interface for the initial
set of
standard features and infoIDs.  Something like:

public static final String VALIDATE = "sax.feature.validation";
public static final String DOCUMENT = "sax.dom.Document";

Then I can do this:
try 
{
      parser.setFeature(ModParser.VALIDATE, true);
} catch (SAXNotRecognizedException e1) 
  {
      // doesn't know about validation 
  } 
  catch (SAXNotSupportedException e2) 
  {
      // Does not support validation
  }

Best wishes,

 - Mike (mdaconta at aol.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