dev@fi.java.net

Re: JAXB Hook for FI

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Thu, 12 May 2005 09:54:50 +0200

Kohsuke Kawaguchi wrote:
>> I see you have written a conversion routine to characters. The code
>> for the builtin encoding algorithms has conversion to text, i am
>> wondering if we can reuse this code.
>
>
> We don't really expect toString or any of those CharSequence
> implementations to be used in a normal situation, so I think slower code
> is OK.
>
> But if the code you have in the FI is something we can copy easily, that
> would be good.
>

The characters should be returned in the specific canonical format
defined by the encoding algorithm so that round tripping of the content
is possible. Mostly this conversion is trivial but since this is
sensitive to any changes (for example the order in which, for example
ints, are processed) it would be better to just have one place where
such conversion occurs.

All the character conversion code is in correspond built-in algorithm
classes such as for the boolean encoding algorithm:

https://fi.dev.java.net/source/browse/fi/FastInfoset/src/com/sun/xml/fastinfoset/algorithm/BooleanEncodingAlgorithm.java?view=markup

Hmm... it is difficult to share things, e.g. JAXB define the interfaces
and FI implement, because of dependencies. So maybe copying is the only
option. We could define such data type char sequences in a separate jar
that is shared between JAXB and FI, but it is still not ideal.


>>> One thing the current XmlVisitor doesn't do well is the attributes.
>>> It relies on SAX's definition, so we can only pass String, not
>>> CharSequence. This has been OK for the MTOM support, but I guess it's
>>> not good for FI. Should I be changing this to something else?
>>>
>>
>> FI supports an extended interface to get access to optimized data. So
>> it would be necessary to cast to this interface and check if there
>> is optimized data present.
>
>
> Which interface is that? I'd like to take a look.
>

See here:

https://fi.dev.java.net/source/browse/fi/FastInfoset/src/org/jvnet/fastinfoset/sax/EncodingAlgorithmAttributes.java?view=markup

The push/pull difference between elements and attributes in SAX is a bit
of a pain :-)

Paul.

P.S. is there any way we can publish a snapshot of the javadoc when the
weekly build occurs?

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