Unable to create a file from xml using smooks ?
boy18nj Jul 25, 2010 5:22 PMIf you see my below code- smooks-res.xml
Step-1
I am changing csv to xml
Step-2
xml to structered xml
Step-3
structered xml to file
Step 1,2 are working. Step-3 is not working. (Please see the below smooks xml to refer steps 1,2,3)
Why it does not creates file from xml ?
<?xml version='1.0' encoding='UTF-8'?>
<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.0.xsd"
xmlns:ftl="http://www.milyn.org/xsd/smooks/freemarker-1.1.xsd">
--Step 1
<resource-config target-profile="from-type:text/csv:order-list AND to-type:text/xml:smooks-order-xml" selector="org.xml.sax.driver">
<resource>org.milyn.csv.CSVParser</resource>
<param name="fields" type="string-list">
orderId,
orderDate,
statusCode,
netAmount,
totalAmount,
tax,
userName,
firstName,
lastName,
state,
orderLine1Position,
orderLine1Quantity,
orderLine1ProductId,
orderLine1ProductTitle,
orderLine1ProductPrice,
orderLine2Position,
orderLine2Quantity,
orderLine2ProductId,
orderLine2ProductTitle,
orderLine2ProductPrice
</param>
</resource-config>
--Step 2
<resource-config target-profile="from-type:text/xml:smooks-order-xml AND to-type:text/xml:canonical-order-xml" selector="csv-set">
<resource type="xsl">
<![CDATA[
<orders>
<xsl:for-each select="csv-record">
<Order orderId="{orderId}"
orderDate="{orderDate}"
statusCode="{statusCode}"
netAmount="{netAmount}"
totalAmount="{totalAmount}"
tax="{tax}" >
<Customer userName="{userName}" firstName="{firstName}" lastName="{lastName}" state="{state}" />
<OrderLines>
<OrderLine posistion="{orderLine1Position}" quantity="{orderLine1Quantity}">
<Product productId="{orderLine1ProductId}" title="{orderLine1ProductTitle}" price="{orderLine1ProductPrice}"/>
</OrderLine>
<OrderLine posistion="{orderLine2Position}" quantity="{orderLine2Quantity}">
<Product productId="{orderLine2ProductId}" title="{orderLine2ProductTitle}" price="{orderLine2ProductPrice}"/>
</OrderLine>
</OrderLines>
</Order>
</xsl:for-each>
</orders>
]]>
</resource>
<param name="is-xslt-templatelet">true</param>
</resource-config>
--Step 3
<resource-config selector="orders">
<resource type="file">org.milyn.routing.file.FileOutputStreamResource</resource>
<param name="resourceName">orderItemSplitStream</param>
<param name="fileNamePattern">order.xml</param>
<param name="destinationDirectoryPattern">C:\\Users\\rocky\\workspace\\transformCSV2XML\\</param>
<param name="listFileNamePattern">order.lst</param>
<param name="highWaterMark">-1</param>
</resource-config>
</smooks-resource-list>