dev@fi.java.net

Re: JAXB Hook for FI

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Tue, 10 May 2005 16:39:16 +0200

Hi,

Sorry, it has taken me far too long to respond to this mail.

I also, in error, requested access to JAXB just now even though you have
added me, I should read more carefully!


In terms of the interface it looks relatively straight forward to
integrate because it is so like SAX.

One of the general problems we will have to tackle is the push me pull
me creature that is JAX-RPC + JAXB. JAX-RPC processing of SOAP messages
is done using a pull model. I could write a rather odd parser that
allows for a pull model via StAX for JAX-RPC to process the SOAP message
infoset and a push model for JAXB to process the content of the SOAP
message (header blocks, body and fault detail children). In some
respects it all depends on how separate we can be for XML and FI
processing. It may be good to reuse all SOAP message infoset level
processing but if the code is not that much then specific access to SOAP
infoset produce from FI using a very simple pull API may only be
required + such an API will never be exposed to developers.


On the specifics about the proposed interface:

- Do you parse the qname string to obtain the prefix? If so i can pass
   the prefix as a separate string as this will be more efficient for
   JAXB and FI.

- For the text method would it be possible to pass in a character array
   just like for SAX. The FI parser could wrap its character buffer
   around a CharSequence impl but access to a direct array would be
   faster. Although perhaps the CharSequence abstraction is used
   throughout JAXB for parsing of content making such support difficult?

- We can have other methods for int[], float[] etc. All optimized data
   types will be arrays even if only one value is present, will this be
   an issue?


When i first looked at the 'expectText' i thought it meant to indicate
that text was expected instead of other forms of data like an array of
integer. But reading the JavaDoc this is not the case. Is the expectText
method most likely to return true for mixed content? Perhaps it would be
clearer to rename it 'expectWhiteSpaceText'?

Paul.

Kohsuke Kawaguchi wrote:
>
> Hi,
>
> For better integration between FI and JAXB, I prepared a hook for FI in
> the JAXB RI.
>
> Internally the unmarshaller implements the XmlVisitor interface [1].
> It's mostly like SAX with a few difference noted in javadoc.
>
> In particular, the text method can take a special class 'Base64Data'
> which allows FI to pass in byte[] directly without going through base64
> encoding.
>
> If the FI parser can do more of the typed data, not just for binary
> data, we can define additional special CharSequence classes.
>
> If someone from the FI team could write a FI parser implementation that
> fires these events, I'm happy to commit them into the JAXB RI repository
> and maintain the code (with your help.)
>
> Also please take opportunity to request an access to the JAXB project so
> that you can see the source code. For this I need to ask you to go
> through a click-through [2]. I already added Paul and Santiago, but I
> couldn't find the java.net ID for the other people.
>
>
> [1]
> http://kohsuke.sfbay/javadoc/jaxb-runtime/com/sun/xml/bind/v2/runtime/unmarshaller/XmlVisitor.html
>
> (sorry for external people --- I have to find a way to post javadoc to
> java.net)
>
> [2] https://jaxb.dev.java.net/source20-gateway/click-through.html

-- 
| ? + ? = To question
----------------\
    Paul Sandoz
         x38109
+33-4-76188109