[jboss-dev-forums] [Design of JBoss ESB] - Re: Problem in XML to CSV transformation

ravikiran_tv do-not-reply at jboss.com
Mon Jul 6 08:04:38 EDT 2009


I tried using Neha's code for smooks-config.xml and XSLT file. 
I used smooks filters to execute the transformation. 



 Smooks smooks = new Smooks("pdm_transformXML2CSV.xml");
  | 		try {
  |             // Create an exec context - no profiles....
  |            ExecutionContext executionContext = smooks.createExecutionContext();
  |            // The result of this transform is a set of CharArray...
  |            CharArrayWriter outputWriter = new CharArrayWriter();
  |            // Configure the execution context to generate a report...
  |            executionContext.setEventListener(new HtmlReportGenerator("report.html"));
  | 
  |            // Filter the input message to extract, using the execution context...
  |              smooks.filter(new StreamSource(new ByteArrayInputStream(messageIn)), new StreamResult(outputWriter), executionContext);
  |            
  |       
  |            System.out.println("***************************");
  |            //System.out.println("Message Status " + pdm.getMsgHeader().getMessageStatus());
  |            System.out.println("Message Header is  " + outputWriter.toString());
  |            System.out.println("***************************");
  |        } finally {
  |            smooks.close();
  |        } 
  | 
  | 

Everything is working fine and I'm able to get exact CSV being transformed from XML template. Thanks Neha for your code - helped me.

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4241970#4241970

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4241970



More information about the jboss-dev-forums mailing list