on 01-01-2014 4:40 AM
Hi Experts,
Need your help to convert XML format without the use of XSLT .
Below is the XML and resultant format :
XML format :
<Rowsets>
<Rowset>
<Row>
<Name>MAKTX</Name>
<Value>12345</Value>
</Row>
<Row>
<Name>MATNR</Name>
<Value>Oloa Volace</Value>
</Rowset>
</Rowsets>
Required format :
<Rowsets>
<Rowset>
<Row>
<MAKTX>12345</MAKTX>
<MATNR>Oloa Volace</MATNR>
</Row>
</Rowset>
</Rowsets>
The tags in the resultant XML will be formed dynamically and are localized.
XSLT doesnt accept special characters and Space.
I am working on MII 14.0
Please help !!!
Thanks
Shashank
Hi Shashank,
I am not sure about localization , however if you need the XML in the format you had mentioned then it is possible. All you need is a repeater, couple of assignment action block and 3 XMLs (Input, Output, and a subXML) and a string variable to append your nodes.
1. Logic, Repeat on source with XPATH : Local.InputXML{/Rowsets/Rowset/Row},
2. assign its output to tempString ..
From: Local.tempString
To : Local.tempString & ("<"&Repeat_source_XML.Output{/Row/Name}&">"&Repeat_source_XML.Output{/Row/Value}&" </"&Repeat_source_XML.Output{/Row/Name}&">")
3. Assign the tempString to a subXML.
From: "<Row>"&Local.tempString&"</Row>"
To: Local.subXMLToAppendRow
You need this because you have to append each row to your output. Since the expression we are writing is not an XML, MII does not allow us to append directly. Hence a work around.
4. Append the subXML to your OutputXML
From: Local.subXMLToAppendRow
To: Transaction.OutXML{/Rowsets/Rowset}
That is it.. you can put a tracer and check the result. It may not look nice but it works
InputXML:
<Rowset>
<Row>
<Name>MAKTX</Name>
<Value>12345</Value>
</Row>
<Row>
<Name>MATNR</Name>
<Value>Oloa Volace</Value>
</Row>
</Rowset>
</Rowsets>
Output XML (Initial):
<Rowsets>
<Rowset>
</Rowset>
</Rowsets>
Final Output XML
<Rowsets>
<Rowset>
<Row>
<MAKTX>12345</MAKTX>
<MATNR>Oloa Volace</MATNR>
</Row>
</Rowset>
</Rowsets>
I have attached a snapshot of my transaction.
Regards
Tufale Ashai
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
12 | |
7 | |
3 | |
2 | |
1 | |
1 | |
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.