AnsweredAssumed Answered

Fetch XML attribute and Map to XML element

Question asked by sujith.59171732 on Jun 17, 2018
Latest reply on Jun 19, 2018 by hemalatha_ediga

Hello,

 

I have a requirement to fetch XML attribute from a stream of input data with XML tags (as shown below - Input) and convert that into a new XML structure (as shown below -Expected Output)  ?

 

Below Input is actually send from database procedure DB profile RETURN Parameter (clob).

 

When I use Map Shape with Source Profile as this Input and Target profile as Vendor XML as its root element and list of fields as it's attributes underneath ,the entire 2 line shown below are get stored in the element Vendor. Of course it will be because , I only have one Source Profile element from database procedure Output (RETURN) which I directly map to target profile element Vendor , and not to its attributes. 

 

How to resolve this and get the data in the format I am expecting (as shown below -Expected Output)  ?

Any suggestions ?

 

Input -   (Database Procedure Output )

<vendor name="ABC" address_line_1="ABC Street" city="MINNEAPOLIS" state_province_code="MN" zip_postal_code="12345"/>
<vendor name="XYZ" address_line_1="XYZ Street" city="MINNEAPOLIS" state_province_code="MN" zip_postal_code="12345"/>

........

 

Expected Output  (Unbounded Vendor xml element)
<vendor>
<name>ABC</name>
<Add_line1>ABC Street</Add_line1>
<city>MINNEAPOLIS</city>
<state_code>MN</state_code>
<Zip_code>12345</Zip_code>
</vendor>
<vendor>
<name>XYZ</name>
<Add_line1>XYZ Street</Add_line1>
<city>MINNEAPOLIS</city>
<state_code>MN</state_code>
<Zip_code>12345</Zip_code>
</vendor>

 

........

Outcomes