Skip to Content
author's profile photo Former Member
Former Member

XML structure change

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

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Posted on Jan 02, 2014 at 05:22 AM

    Check this thread, it will help you.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 06, 2014 at 05:00 PM

    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


    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.