Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JAXB, SAX and XSLT Transformation

843834Apr 12 2007 — edited Aug 22 2008
Hi,
I'm trying to get to grips with JAXB, SAX and XSLT
Basically I've got a JAXB Java Model and and when its Serializing requires an OutputFormatter to setup NonEscapingElements.
I then want to transform this three times.

At the moment I'm just using serializing the XML to file, and then using SAX, alongside 3 xmlFilters to perform the translations.

What I can't get around my head is how to get the JAXB serialized output into the XSLT process without writing to a file or to an ByteArrayStream

The way I start the XSLT process is :-
XMLFilter filter3 = stf.newXMLFilter(new StreamSource("XFORM3.XSL"));
filter3.parse(new InputSource("JAXBGENERATED.XML"));

Or alternateively I can Serialize to a Stream :-

ByteArrayOutputStream docOutputStream = new ByteArrayOutputStream();
m.marshal(policies,docOutputStream);
ByteArrayInputStream docInputStream = new ByteArrayInputStream(docOutputStream.toByteArray());
InputSource inputSource = new InputSource(docInputStream);

return inputSource;


I'd really appreciate any guidance, as I'm sure this isn't the most efficient way of doing things.

Thanks in advance

Message was edited by:
simon_french
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 19 2008
Added on Apr 12 2007
7 comments
596 views