users@jax-ws.java.net

Avoid both JAXB2 binding as well DOM creation for a document fragment?

From: Andreas Loew <Andreas.Loew_at_Sun.COM>
Date: Mon, 21 May 2007 16:44:21 +0200

(Apologies for cross-posting to JAX-WS and JAXB - I simply was unable to
determine which list would be the most appropriate place to post this
question to...)


All,

I have to deal with a very specific Web Service where an "outer" request
document (i.e. the SOAP body) kind of wraps a nested "inner" XML
document fragment as an xsd:any type.

I do know that I can annotate xsd:any using the jaxb:dom annotation in
order to get the wrapped document being converted into a W3C DOM instance.

As these inner documents may become quite large (several MBs), from a
memory consumption and performance perspective, I'd prefer not to create
a DOM representation for the inner fragment, but rather get access to
the "plain XML source", such as by getting direct access to the
Unmarshaller's document source - ideally, the StAX XMLStreamReader or
XMLEventReader.

Unfortunately,
https://jaxb.dev.java.net/guide/Avoid_strong_databinding.html
for now seems just a work in progress... :-)

So my question is:

Is there any way to get access to the original document source for the
inner fragment, while still using JAX-WS/JAXB2 to map the overall
document in order to easily process the outer part's content:

- to avoid mapping/binding of the inner fragment to Java classes
- to avoid creation of a DOM tree representing the inner fragment as well
- but to "simply" get access to the original source/fragment (as being
internally provided to the Unmarshaller by the JAX-WS implementation)

Many thanks in advance for any help with this!

Best regards,

Andreas

-- 
Andreas Loew
Java Architect
Sun Microsystems (Germany)