This tutorial illustrates is how to generate a stream of SAX events from a CSV stream and how that stream of SAX events feeds into Smooks to generate an XML model that can be transformed further (in this case it is not).
Other Relevant Info:
Transforming from CSV to XMLThis is a very simple example that illustrates how Smooks to configure in a non-XML stream parser (CSV) into Smooks. So here's the source csv file that is to be transformed: Tom,Fennelly,Male,4,Ireland And this is the expected result of our transformation (as generated by the CSVParser): <csv-set> The Smooks ConfigurationWe simply specify the CSVParser as the stream parser. More transformation configurations could be added to transform this message further. Here's the configuration ("smooks-config.xml"): <?xml version="1.0"?> Executing The TransformationAgain, it's exactly the same as with the java-basic tutorial: Smooks smooks = new Smooks("smooks-config.xml");Of course, you'd typically cache the Smooks instance. See the example/Main.java in the example source. |