Announcement: SAX2 1999-06-01 alpha release for Java
Lars Marius Garshol
larsga at ifi.uio.no
Thu Jun 3 09:36:24 BST 1999
* David Megginson
|
| 1. Do we need a filter *interface* at all, or can a filter just be a
| class that happens to implement Parser, Configurable,
| EntityResolver, DTDHandler, DocumentHandler, and ErrorHandler? (In
| other words, is it enough to set the parent parser/filter in the
| constructor?)
I'm more concerned with interoperability than ease of development,
really, and a main point is that assemblies of filters should be easy
to put together. The trouble with the above is that once the filter is
instantiated its position in the assembly is fixed. So I am not
satisfied with just setting the event source in the constructor.
Another thing is the business with delegation that John mentioned.
This monster interface could be reduced somewhat by replacing an
interface with a corresponding getInterface method on the filter,
returning either the private object or the filter itself. Or we could
just reason that the clients of the filter don't need access to its
handlers, and do this:
public interface Filter extends Parser {
public Parser getEventSource();
public void setEventSource(Parser eventSource);
public Configurable getConfigurable();
}
This ensures that filters can be moved around in the assembly and that
they can support configuration if they so wish (and return null if
they don't). It also makes it much clearer from the interface what a
filter is and does and enables the hiding of the handler implementation(s).
As for FilterAdapter (or FilterBase), it could either do what you
proposed that filter do above, or be split into an implementation of
filter that uses a near cousin of HandlerBase called Propagator or
some such.
| [org.xml.sax.helpers.FilterAdapter]
|
| I was thinking of including this class in the next SAX2
| pre-release, if people are interested; I can also distribute it
| separately in the mean time.
I am definitely interested in seeing it now.
And like David I would also like to see John's list of subtle points.
For those interested in prior art, Bill la Forge's MDSAX is also very
much worth a look: <URL: http://www.jxml.com/mdsax/>
I see that his MDFilters are interfaces that extend Parser,
DocumentHandler, DTDHandler, EntityResolver and ErrorHandler, and add
a setParser method.
--Lars M.
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