ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » XML to XML transformation using XSL in Java comput node

Post new topic  Reply to topic
 XML to XML transformation using XSL in Java comput node « View previous topic :: View next topic » 
Author Message
gmummineni
PostPosted: Fri Sep 04, 2009 3:54 am    Post subject: XML to XML transformation using XSL in Java comput node Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » XML to XML transformation using XSL in Java comput node
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.