|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
XML to XML transformation using XSL in Java comput node |
« View previous topic :: View next topic » |
Author |
Message
|
gmummineni |
Posted: Fri Sep 04, 2009 3:54 am Post subject: XML to XML transformation using XSL in Java comput node |
|
|
 Newbie
Joined: 04 Sep 2009 Posts: 3
|
I've a requirement to use a java compute node and do XML to XML transformation using XSL with in Java class.
I know it's easy if we use XSLT node. But, we've to use JCN with XSL.
Below is the code snippet I use to do transformation using XSL:
MbElement inBody = inMessage.getRootElement().getLastChild();
byte[] inputBodyBytes = inBody.toBitstream(null, null, null, 0, -1,
0);
TransformerFactory factory = TransformerFactory.newInstance();
Templates template;
template = factory.newTemplates(new StreamSource(
new FileInputStream(xslPath)));
Transformer transformer = template.newTransformer();
InputStream input1 = new ByteArrayInputStream(inputBodyBytes);
OutputStream output = new ByteArrayOutputStream(
inputBodyBytes.length);
Source source = new StreamSource(input1);
Result result = new StreamResult(output);
transformer.transform(source, result);
Could any one please let me know how should we generate output message (MbMessage) using output byte array stream?
Firstly, if this is not right approach, could you please suggest me the right one?
Thnx in advance. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|