Quick question on Smooks transforms, wondering if anyone has had any experience of the same thing, if so time to shine!
Simple really I have a (very large) .csv file and I want to transform it to another .csv format (columns switched etc)..
smooks config file is below.... (Bit of background, it's going through wso2 if that makes any difference - that bit is working fine!)
<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" xmlns:ftl="http://www.milyn.org/xsd/smooks/freemarker-1.1.xsd">
<params>
<param name="stream.filter.type">SAX</param>
</params>
<csv:reader fields="ParentSKU,AttributeSKU,WarehouseID,Published,Stock,SellingPrice,InventoryValue" rootElementName="records" recordElementName="row"/>
<resource-config selector="row">
<resource>org.milyn.delivery.DomModelCreator</resource>
</resource-config>
<ftl:freemarker applyOnElement="row">
<ftl:template><![CDATA[${row.ParentSKU},${row.AttributeSKU},${row.WarehouseID},${row.Published},${row.Stock},${row.SellingPrice},${row.InventoryValue}]]></ftl:template>
<param name="quote">"</param>
<param name="includeFieldNames">true</param>
<param name="csvFields">ParentSKU,AttributeSKU,WarehouseID,Published,Stock,SellingPrice,InventoryValue</param>
<param name="seperator">,</param>
<param name="messageType">CSV</param>
</ftl:freemarker>
</smooks-resource-list>
The input file looks something like:
Parent SKU,Attribute SKU,Warehouse ID,Published,Stock,Selling Price,Inventory Value
23551288,,fc,0,0,119.99,0
78234225,,fc,0,0,39.99,0
85275286,,fc,0,0,9.99,0
71235376,7.14034E+12,fc,1,4,24,96
45340656,,fc,0,0,6,0
12343674,,fc,0,0,79.99,0
78049868,,fc,0,0,39.99,0
12082748,,fc,0,0,69.99,0
18302384,,fc,0,0,19.99,0
31366094,,fc,0,0,19.99,0
The problem is that in the output I get the record tags in the output how can I stop this - I have been trying different things for the last 24 hours.
<records>Parent SKU,Attribute SKU,Warehouse ID,Published,Stock,Selling Price,Inventory Value
23551288,,fc,0,0,119.99,0
78234225,,fc,0,0,39.99,0
85275286,,fc,0,0,9.99,0
71235376,7.14034E+12,fc,1,4,24,96
45340656,,fc,0,0,6,0
12343674,,fc,0,0,79.99,0
78049868,,fc,0,0,39.99,0
12082748,,fc,0,0,69.99,0
18302384,,fc,0,0,19.99,0
31366094,,fc,0,0,19.99,0
</records>
Ideally I would prefer to use smooks configuration only so that I can give this to developers who are not java aware.
I have also tried using
<csv:reader fields="ParentSKU,AttributeSKU,WarehouseID,Published,Stock,SellingPrice,InventoryValue" recordElementName="record" rootElementName="row" skipLines="1">
<csv:singleBinding beanId="row" class="java.util.HashMap"/>
</csv:reader>
in place of the resource config node but it does the same thing.
Thanks in advance.