Read flat file line by line using smooks

381 Views Asked by At

I have a flat file as input. I need to read the flat file line by line using Smooks. Can anyone please give me suggestions or sample code how to do it.

1

There are 1 best solutions below

2
On

Here is Smooks Config file (SmooksConfig_ForFlatFile.xml).

here is Input File (input-messages.txt) charles moulliard Male 43BE maxence dewil Male 30NL eleonor moulliard Female 12AD

Here is the java code: smooks = new Smooks("SmooksConfig_ForFlatFile.xml");

        FileOutputStream fos = new FileOutputStream("FlatFile_Output.xml");
        smooks.filterSource(new StreamSource(new FileInputStream("input-message.txt")), new StreamResult(fos));