| Author |
Returning a byte-array after performing an XSLT
|
Martin Fiskare
Greenhorn
Joined: Jun 24, 2010
Posts: 7
|
|
Hej!
Me again with another nerve-wrecking issue, since I'm not very experienced witj java and xml
What i need to do is marshal Dummy.class and return the result in form of a byte array. Problem is I can't do that straight like marshalling directly into a ByteOutputStream, because I have to modify the output by performing an XSLT.
In other words, what I want to do is
- Marshal my class structure to whatever result might be necessary
- transform the result
- return the result in form of a byte-array.
That's what I have right now..
Thanks thousandfold in advance for any help
|
 |
Karthik Shiraly
Ranch Hand
Joined: Apr 04, 2009
Posts: 364
|
|
|
Use javax.xml.bind.util.JAXBSource
|
 |
Martin Fiskare
Greenhorn
Joined: Jun 24, 2010
Posts: 7
|
|
Ok, that looks useful at the first glance.. but, when does the actual marshalling happen?
Does is happen implicitly when I instantiate the JAXBSource?
And besides.. the result of the transformation has somehow to be a byte-array.. and i have no clue how I can achieve that.
|
 |
Karthik Shiraly
Ranch Hand
Joined: Apr 04, 2009
Posts: 364
|
|
Both marshalling and transformation happen when the transform() is called. JAXBSource is just an adaptor between JAXB and transformer - it calls marshal() as soon as the transformer asks it for an XML input stream.
As for the byte array, well you're already half way there:
|
 |
Karthik Shiraly
Ranch Hand
Joined: Apr 04, 2009
Posts: 364
|
|
|
Just occurred to me now...why do you need a byte array as output? Perhaps there is a better way, if you can explain the circumstances.
|
 |
 |
|
|
subject: Returning a byte-array after performing an XSLT
|
|
|