[Biojava-l] [StAX] returning objects from delegated ContentHandlers

Thomas Down td2@sanger.ac.uk
Wed, 13 Jun 2001 14:24:31 +0100


On Wed, Jun 13, 2001 at 08:22:46AM -0500, Wiepert, Mathieu wrote:
> With no prior knowledge of StAX, can you plug in a StAX parser to an XSLT
> processor, like Saxon?  Fishing for info on how similar it is to a SAX
> parser, to outside apps expecting SAX output.  

The StAX APIs are currently in the BioJava tree
(package org.biojava.utils.stax).  The original design
concept was that StAX APIs are exactly the same as SAX
/except/ that sub-trees of the document can be delegated
to another ContentHandler (allowing you to build rather
neat, modular, parsers).

Right now, there isn't such a thing as a StAX parser.
There's a lightweight adaptor (imaginatively called
SAX2StAXAdaptor) which wraps a top-level StAXContentHandler
object and makes it look like a normal SAX ContentHandler.
So you can use StAX with any XML parser (or other source
of SAX events -- the BioJava BLAST parsers / an XSLT processor/
whatever).

Up 'til now there's been no requests for an adaptor to go
the other way (e.g. plug a SAX handler into a StAX event
source).  If anyone ever wanted it, it would be totally
trivial to write, though.

   Thomas.