Respected Sir,
I am using smooks mediator to process huge xml in wso2.
Using the smooksConfig file attached .
I am able to parse below below sample input structure.
<?xml version="1.0"?><catalog>
<book id="bk101">
<author>Gambardella Matthew</author>
<title>XML Developer's Guide</title>
<genre>Computer</genre>
<price>44.95</price>
<publish_date>2000-10-01</publish_date>
<description>Epic1</description>
</book>
<book id="bk102">
<author>Ralls Kim</author>
<title>Midnight Rain</title>
<genre>Fantasy</genre>
<price>5.95</price>
<publish_date>2000-12-16</publish_date>
<description>Epic2</description>
</book> </catalog>
But for another structure like below. Not able to decide, how the resource
selector will decide , for which book tag to create book model.
I am able to parse below below sample input structure.
<?xml version="1.0"?><catalog>
<library1>
<book id="bk101">
<name>XML Developer's Guide</name>
<price>44.95</price>
</book>
</library1>
<book id="bk101">
<author>Gambardella Matthew</author>
<title>XML Developer's Guide</title>
<genre>Computer</genre>
<price>44.95</price>
<publish_date>2000-10-01</publish_date>
<description>Epic1</description>
</book>
<book id="bk102">
<author>Ralls Kim</author>
<title>Midnight Rain</title>
<genre>Fantasy</genre>
<price>5.95</price>
<publish_date>2000-12-16</publish_date>
<description>Epic2</description>
</book> </catalog>
resource selector in smooksConfig file attached is like below:
<resource-config selector="catalog,book">
<resource>org.milyn.delivery.DomModelCreator</resource>
</resource-config>
from above configuration I understand it will one catalog model and one
book model. but the book model will be created for which book tag
catalog/library1/book
or catalog/book ?
I read many documents on internet. Even below example but could not get
concept.
https://access.redhat.com/documentation/en-us/red_hat_jboss_fuse/6.3/html/smooks_development_guide/example_of_using_sax1
please guide.
With Regards Aditya
<?xml version="1.0" encoding="UTF-8"?>
<proxy name="SmooksBigFile" startOnLoad="true" transports="vfs" xmlns="http://ws.apache.org/ns/synapse">
<target>
<inSequence>
<log level="custom">
<property name="property_name" value=""Inside FlatFile ***************************************** ""/>
</log>
<property name="FORCE_SC_ACCEPTED" scope="axis2" type="STRING" value="true"/>
<property name="REST_URL_POSTFIX" scope="axis2" type="STRING" value=""/>
<property action="remove" name="ClientApiNonBlocking" scope="axis2"/>
<!-- <property name="DISABLE_SMOOKS_RESULT_PAYLOAD" value="true"/> -->
<smooks config-key="gov:custom/smooksConfig.xml">
<input type="xml"/>
<output type="text"/>
</smooks>
<property expression="fn:concat(fn:substring-after(get-property('MessageID'), 'urn:uuid:'), '.csv')" name="transport.vfs.ReplyFileName" scope="transport" type="STRING"/>
<property name="OUT_ONLY" scope="default" type="STRING" value="true"/>
<property name="messageType" scope="axis2" type="STRING" value="application/csv"/>
<property action="remove" name="LAST_MODIFIED" scope="transport"/>
<send>
<endpoint>
<address uri="vfs:file:///C:/Flatfile/output"/>
</endpoint>
</send>
</inSequence>
<outSequence/>
<faultSequence/>
</target>
<parameter name="transport.vfs.Streaming">true</parameter>
<parameter name="transport.PollInterval">50ms</parameter>
<parameter name="transport.vfs.ContentType">application/xml</parameter>
<parameter name="transport.vfs.FileURI">file:///C:/Flatfile/input</parameter>
<parameter name="transport.vfs.ActionAfterProcess">MOVE</parameter>
<parameter name="transport.vfs.MoveAfterFailure">file:///C:/Flatfile/failure</parameter>
<parameter name="transport.vfs.ActionAfterFailure">MOVE</parameter>
<parameter name="transport.vfs.FileNamePattern">.*\.xml</parameter>
<parameter name="transport.vfs.Locking">disable</parameter>
<parameter name="transport.vfs.MoveAfterProcess">file:///C:/Flatfile/orgFilesProcessedSuccessfully</parameter>
</proxy>
<?xml version="1.0" encoding="UTF-8"?>
<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"
xmlns:ftl="http://www.milyn.org/xsd/smooks/freemarker-1.1.xsd">
<params>
<param name="stream.filter.type">SAX</param>
<!-- <param name="inputType">input.xml</param>
<param name="input.xml" type="input.type.actived">File:/C:\Work\2016\09_ESB_Auto_Mail_rpts\TestFiles\TestFileXMLCSVMap.xml
</param> -->
<param name="default.serialization.on">true</param>
</params>
<resource-config selector="catalog,book">
<resource>org.milyn.delivery.DomModelCreator</resource>
</resource-config>
<ftl:freemarker applyOnElement="catalog">
<ftl:template><!--<#ftl >author,title,genre<?TEMPLATE-SPLIT-PI?>
-->
</ftl:template>
</ftl:freemarker>
<ftl:freemarker applyOnElement="book">
<ftl:template>
<!-- <#ftl > ${book.author},${.vars["book"].title},${.vars["book"].genre} -->
</ftl:template>
<param name="quote">"</param>
<param name="includeFieldNames">true</param>
<param name="csvFields">author,title,genre</param>
<param name="seperator">,</param>
<param name="messageType">CSV</param>
<param name="templateDataProvider">input</param>
</ftl:freemarker>
</smooks-resource-list>_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev