on ‎2012 Jan 13 7:04 AM
Hi,
Request your suggestions on best way to convert CSV to XML
CSV u2013 MII should read below data from a file
1,a1,aaaa
1,a1,bbbb
1,a2,cccc
1,a2,dddd
2,a3,eeee
2,a3,ffff
2,a4,gggg
2,a4,hhhh
Intermediate MII XML
<Rowsets>
<Rowset>
<Row>
<Item>1</Item>
</Row>
<Row>
<Item>a1</Item>
</Row>
<Row>
<Item>aaaa</Item>
</Row>
</Rowset>
<Rowset>
<Row>
<Item>1</Item>
</Row>
<Row>
<Item>a1</Item>
</Row>
<Row>
<Item>bbbb</Item>
</Row>
</Rowset>
::::
::::
::::
<Rowset>
<Row>
<Item>2</Item>
</Row>
<Row>
<Item>a4</Item>
</Row>
<Row>
<Item>hhhh</Item>
</Row>
</Rowset>
</Rowsets>
Target XML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<mainnode>
<repeatnode1>
<node1_id>1</node1_id>
<repeatnode2>
<node2_id>a1</node2_id>
<repeatnode3>
<name>aaaa</name>
</repeatnode3>
<repeatnode3>
<name>bbbb</name>
</repeatnode3>
</repeatnode2>
<repeatnode2>
<node2_id>a2</node2_id>
<repeatnode3>
<name>cccc</name>
</repeatnode3>
<repeatnode3>
<name>dddd</name>
</repeatnode3>
</repeatnode2>
</repeatnode1>
<repeatnode1>
<node1_id>2</node1_id>
<repeatnode2>
<node2_id>a3</node2_id>
<repeatnode3>
<name>eeee</name>
</repeatnode3>
<repeatnode3>
<name>ffff</name>
</repeatnode3>
</repeatnode2>
<repeatnode2>
<node2_id>a4</node2_id>
<repeatnode3>
<name>gggg</name>
</repeatnode3>
<repeatnode3>
<name>hhhh</name>
</repeatnode3>
</repeatnode2>
</repeatnode1>
</mainnode>
Mapping Points/Constraints
u2022 Repeatnode1,repeatnode2 and repeatnode3 in the output XMl are UNBOUNDED
Actions taken so far:
u2022 Read file using GetFile list Action block
u2022 Assign file content to Text_Loader.StringContentu2013 Using TextLoader action block u2013 Query u2013 Records in this text file may be up to 20000 , will all the records fit to Text_Loader.StringContent?
u2022 Read individual line u2013 Flat_file_Parser action block
u2022 Convert Line string to MII XML using String_List_toXML parser
u2022 Now problem is converting MII XML to XML
Optimal way conversion methodologies are requested.
Thanks
Rajesh
Request clarification before answering.
Hi,
There is a custom action action block that does whatever you want.
Please look into the link below:
Link - [Falt file parser|http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/b0c1f975-f163-2d10-a596-c1c9ef91f2d6]
Thanks,
Suhas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rajesh,
I would look to an XSLT to transform the xml for your last step.
Regards,
Mike
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.