Search code examples
smookswso2-esb

VFS options for tab delimited file in WSO2 ESB


Can someone guide on how to process tab-seperated input textfile using VFS transport in WSO2 ESB ? In general, how can I transform a tab-separated file into a structures format (XML for WSO2)? Using smooks mediator can easily parse comma delimited file and works fine but there is no documentation around parsing capability using other delimiters. For CSV below smooks config works fine, please explain how this can be modified to process tab delimited.

<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd" xmlns:csv="http://www.milyn.org/xsd/smooks/csv-1.2.xsd"> <resource-config selector="org.xml.sax.driver"> <resource>org.milyn.csv.CSVReader</resource> <param name="fields">field1, field2, field3</param> <param name="rootElementName">FileDetailRecord</param> <param name="recordElementName">Detail</param> </resource-config> </smooks-resource-list>


Solution

  • You may have worked this out, but I'm answering for the benefit of other users also. Specifying the delimiter should work. Try adding:

    <csv:reader fields="firstname,lastname,gender,age,country" separator="&#9;" />
    

    Here is a discussion on the Smooks site about configuring the csv reader to handle tab-delimited files. [1]

    -Colin

    [1] https://jira.codehaus.org/browse/MILYN-462