0

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>

4

2 回答 2

1

它可以实现为 -

<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="separator">|</param> <param name="rootElementName">FileDetailRecord</param> <param name="recordElementName">Detail</param> </resource-config> </smooks-resource-list>

于 2014-07-30T18:53:52.617 回答
1

您可能已经解决了这个问题,但我也在回答其他用户的利益。指定分隔符应该可以工作。尝试添加:

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

这是 Smooks 站点上关于配置 csv 阅读器以处理制表符分隔文件的讨论。[1]

-科林

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

于 2014-07-28T14:08:16.023 回答