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

Wiepert, Mathieu Wiepert.Mathieu@mayo.edu
Wed, 13 Jun 2001 08:22:46 -0500


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.  

-Mat

 -----Original Message-----
From: 	Thomas Down [mailto:td2@sanger.ac.uk] 
Sent:	Wednesday, June 13, 2001 7:50 AM
To:	biojava-l@biojava.org
Subject:	[Biojava-l] [StAX] returning objects from delegated
ContentHandlers

Posting this to biojava-l since there isn't really anywhere
else.  Given than StAX doesn't actually have anything to
do with BioJava (other than historically) I'm wondering if
it might be worth setting up a SourceForge project.  Any thoughts?



Anyway, the current status of StAX is that it seems to be
working very nicely for a number of users.  There does seem
to be one recurrant issue that comes up -- how to cleanly
return data from delegate ContentHandlers.  I'm considering
the possibility of one more API change, to try to resolve
this once and for all.  I'd really prefer to avoid changing
the API, but this issue comes up sufficiently frequently that
it might be worth breaking things now rather than later...

The original StAX didn't have any mechanism for ContentHandlers
to return data at all.  The assumption was that each ContentHandler
would have access to some kind of callback for passing any
data back.

After some complaints, the `second draft' of StAX added an extra
parameter on endElement.  If the element was delegated, the delegate
ContentHandler gets passed back.  This has been used quite a bit
in some applications, but it still strikes me as ugly.


Proposed alternative:

  - Change StAXContentHandler.endTree() so that it returns an Object
    (may be null).  To get the existing behaviour:

       public Object endTree() {
           return this;
       }

  - Either:

     + Change the `delegate' parameter on endElement to be the
       returned object

     + add new method "endDelegation(Object returnValue)"


Either version of this solution will require existing handlers to be
changed a little.  I think it will make for cleaner code in the
long term, though.

What's the opinion of this.  Should we have one more round of
polishing on StAX before presenting it to the wider world, or
should it stay as it is?

    Thomas.
_______________________________________________
Biojava-l mailing list  -  Biojava-l@biojava.org
http://biojava.org/mailman/listinfo/biojava-l