Quantcast
Channel: SCN : All Content - Process Integration (PI) & SOA Middleware
Viewing all articles
Browse latest Browse all 7030

Read XML tags dynamically

$
0
0

Hi

 

I have to read the XML dynamically , please see the input and expected output

 

Input:

 

String inputPayload = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"

                                                + "<records xsi:type=\"Opportunity\">"

                                                + "<Id>ABCD</Id>"

                                                + "<Amount>1000.0</Amount>" + "</records>";

 

 

Output

 

"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"

< data>

  <Object name> Opportunity  </Object name>

   <records>

     <FiledName>ID</FiledName>

     <FiledValue>ABCD</FiledValue>

   <records>

   <records>

     <FiledName>Amount</FiledName>

     <FiledValue>1000.0</FiledValue>

   <records>

< /data>

 

Please note that  the tags Opportunity, ID,Amount etc are dynamic.

 

Can you please tell how to read this using DOM/SAX or any other method?


Viewing all articles
Browse latest Browse all 7030

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>