luohao
luohao

Reputation: 135

WSO2 How to transform file

Now I have a local file just like :

<userCode>001</userCode><productCode>001</productCode><Fee>1.00</Fee>
<userCode>002</userCode><productCode>002</productCode><Fee>2.00</Fee>
<userCode>003</userCode><productCode>003</productCode><Fee>3.00</Fee>;

I need transform this file to :

<Fee>1.00</Fee><productCode>001</productCode>
<Fee>2.00</Fee><productCode>002</productCode>
<Fee>3.00</Fee><productCode>003</productCode>

I think I need read first and then write. How to do this in WSO2?

Upvotes: 0

Views: 149

Answers (1)

CharithWiki
CharithWiki

Reputation: 175

I hope you have a Top level element which wraps this data. Making this a proper xml. ex :

    <data><userCode>001</userCode><productCode>001</productCode><Fee>1.00</Fee>... </data>

Steps

1) Configure VFS transport sender and receiver in axis2.xml

2) Engage ApplicationXML Message builder and formatter for your content type (This can be any ex : file/xml)

3) Configure a VFS proxy to listen to this content type in a given directory.

4) When message comes use XSLT mediator to do the transformation

5) Use VFS sender to store the transformed file.

thanks, Charith

Upvotes: 1

Related Questions