Blessed Geek
Blessed Geek

Reputation: 21664

EXI get JAXB unmarshaller

I wish to know the EXI equivalent of the JAXB unmarshaller.

I have looked at the EXI examples, where I have successfully obtained EXIFactory, set the grammar, get the XMLReader.

The example then creates a transformer to transform EXI stream to XML stream.

However, I do not need the output stream. I just need the unmarshalled result to stay as in-memory POJOs. I need the result to be direct unmarshall of EXI. I am using EXI marshall/unmarshall as a faster alternative to text XML.

Forgot to say which library I was using. Here it is:

   <groupId>com.siemens.ct.exi</groupId>
   <artifactId>exificient</artifactId>
   <version>0.9.6</version>

Upvotes: 0

Views: 246

Answers (1)

Daniel Peintner
Daniel Peintner

Reputation: 79

JAXB Marshaller/Unmarshaller let you set various input/output mechanism

e.g. Unmarshaller.unmarshal( javax.xml.transform.Source source )

or

Marshaller.marshal( Object jaxbElement, javax.xml.transform.Result result )

EXIficient implements

javax.xml.transform.Source (see com.siemens.ct.exi.api.sax.EXISource)

javax.xml.transform.Result (see com.siemens.ct.exi.api.sax.EXIResult)

Both, EXISource and EXIResult, can be initialized with the EXIFactory.

Hope this helps,

-- Daniel

Upvotes: 1

Related Questions