Skip to main content

Fast Infoset and JAXB

4 replies [Last post]
bluelemming
Offline
Joined: 2006-12-12
Points: 0

Hi all,

I'm looking into using the above combination - am I correct in understanding (from reading Kohsuke Kawaguchi's blog) that if I serialise/deserialise my JAXB objects using the Fast Infoset implementations of StAX et al, that this will be automatically detected and some sort of internal interface used? Does this mean that primitive data that is encoded by Fast Infoset in a binary format will not be converted to and from Strings in order to use the standard XML interfaces?

Thanks,
Colin

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
sandoz
Offline
Joined: 2003-06-20
Points: 0

Hi Colin,

> I'm looking into using the above combination - am I
> correct in understanding (from reading Kohsuke
> Kawaguchi's blog) that if I serialise/deserialise my
> JAXB objects using the Fast Infoset implementations
> of StAX et al, that this will be automatically
> detected and some sort of internal interface used?

Yes, you are correct.

> Does this mean that primitive data that is encoded by
> Fast Infoset in a binary format will not be converted
> to and from Strings in order to use the standard XML
> interfaces?
>

Unfortunately this currently only works for byte[] (that for XML documents would be base64 encoded).

BTW for optimal performance JAXB 2.0.x needs to use FI 1.1.x [1], and JAXB 2.1.x needs to use FI 1.2.x [2]. (The reverse combinations will be functionality but no optimal).

Paul.

[1] https://fi.dev.java.net/files/documents/2634/45601/FastInfoset.dist.zip
[2] https://fi.dev.java.net/servlets/ProjectDocumentList?folderID=5846&expan...

bluelemming
Offline
Joined: 2006-12-12
Points: 0

Hi Paul,

Thanks for the quick reply! Are there any plans to implement this functionality? Or is there any way I can hack it myself? I haven't had a good look at the FI code, does it expose any sort of useful interface to the PER parsing code? Ideally for my uses I'd like to use the Fast Schema approach, but the tools are pretty expensive - I'm trying to work out if I can cobble something together myself.

Thanks,
Colin

sandoz
Offline
Joined: 2003-06-20
Points: 0

Hi Colin,

There are no plans to implement the Fast Schema approach.

We would like to support more typing with JAXB with FI with extensions to the StAX API but we do not have a concrete time frame when this might occur.

Paul.

aaronanderson
Offline
Joined: 2004-01-23
Points: 0

I am intrigued by the JAXB and FI combination as well. I am interested in creating a JAXB binding for the Collada specification (http://khronos.org/collada/) and using FI as a marshaling approach to efficiently store and retrieve the geometric data from a binary FI document.

So far I have attempted to use the FI xmltosaxtotypedfi script to import the Collada xsd and a sample Collada document lunar_vehicle_tris.dae (http://www.collada.org/owl/browse.php?sess=0&parent=57&expand=1&order=na...) The result didn't turn out as well as I wished, with the simpleTypes that were xs:lists of ints and floats not being encoded with a built in algorithm but instead serialized as string data.

Based on my FI research I have a couple of questions about the JAXB and FI integration.

1.My understanding of FI built in algorithms is limited. Are built in algorithms included in the FI vocabulary information or are they only specified during encoding and decoding as demonstrated in the PrimitiveTypesWithElementContentSample sample?
2.If I wish to create my own built in algorithm, what procedure I would I need to follow? I am interested in duplicating and modifying the FloatEncodingAlgorithm and IntegerEncodingAlgoritms to store the data in NIO FloatBuffer's and IntBuffer's respectively instead of arrays.
3. How is the FI vocabulary built when used with JAXB? Is the JAXB schema model passed to FI and then it generates a vocabulary every time a JAXB hierarchy is marshaled? Is it possible to create a custom external vocabulary for a schema and tell the FI marshaller used by JAXB to use that vocabulary?
4.What are the future plans for JAXB and FI integration? Will one someday be able to create a JAXB schema binding with a custom binding extension for FI that can direct the FI marshaller on how to encode the JAXB data?