JAXB, SAX and XSLT Transformation
843834Apr 12 2007 — edited Aug 22 2008Hi,
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