Hi Aaron,
I think the Cursor API is the right fundamental abstraction to extend
(for example look at MS's .Net reader API). Any Event API extensions can
be built on top of the Cursor API extensions. In my experience at least
the Event API is not used much (we have never used it in our Web
services stack simply because and we found it offers no advantage over
using just the Cursor API).
One way the cursor API could be extended is to have additional iface
that allows one to access sub-events of character and access things as
integers etc. e.g. readTextAsInteger, readTextAsArrayOfIntegers. Such an
the API could work for both XML, FI and other binary XML formats. (Note
that such functionality may have to take into account potentially tricky
edge cases such as in-fixed comments and processing instructions.)
I believe the right approach is to experimentally develop such
extensions in the FI workspace using the FI implementation. After good
implementation experience i think we should encourage this to be part of
a generic interface e.g. part of stax-ex project [1], which currently
extends the StAX cursor API in a limited manner, and encourage XML
implementations e.g. SJSXP and Woodstox. Then binding technologies, e.g.
JAXB implementations, can potentially take advantage of such
implementations and the interface to improve binding performance when
using XML and Binary XML parsers. (Note that i think it important to
keep in mind the binding use-case. In such cases a binder will often
have an expectation of what the next event will be.)
There are others on this list who have very good experience with StAX
and could provide invaluable feedback in any APIs extension you may
propose. So i think you are in good company :-)
Paul.
[1]
https://stax-ex.dev.java.net
Aaron Anderson wrote:
> I have read several references about extending the StAX API to
> support FI built-in algorithms. Is there any time line for this to
> occur?
>
> While the StAX cursor API is rigidly typed for Strings it seems the
> event API is more extensible. According to
> http://java.sun.com/webservices/docs/1.6/tutorial/doc/SJSXP3.html
>
> "You can create subtypes of XMLEvent that are either completely new
> information items or extensions of existing items but with additional
> methods."
>
> I am interested in using StAX in conjunction with FI in order to
> parse in an XML document that contains numerous float and integer
> arrays. I would like to leverage the parsing model of StAX while
> still being able to access the raw FI primitive data arrays read into
> memory and avoid decoding them as strings.
>
> Would it be feasible to create a new version of the StAXEventReader
> that would emit custom XMLEvents that would contain additional
> methods to access the underlying FI data?
>
> For example,
>
> XMLEventReader r = new StAXEventReader2(new
> FileInputStream(filename)); float[] data; while(r.hasNext()) {
> XMLEvent e = r.nextEvent(); if (e instance of Characters){ if (e
> instanceof FICharactersEvent){
> data=((FICharactersEvent)e).getFloatData(); }else{
> data=myFloatStringParserMethod((Characters)e).getData()); } } }
>
>
> Any comments?
>
>
>
>
>
>
>
>
> ____________________________________________________________________________________
> No need to miss a message. Get email on-the-go with Yahoo! Mail for
> Mobile. Get started. http://mobile.yahoo.com/mail
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_fi.dev.java.net For
> additional commands, e-mail: users-help_at_fi.dev.java.net
>
--
| ? + ? = To question
----------------\
Paul Sandoz
x38109
+33-4-76188109