nc work

nc work

  • NA
  • 23
  • 2k

concatenate xmls in list to one xml

Nov 28 2017 11:18 AM
I have list of xmls files each item has xml string, I would like to concatenate all xmls in list to one xml.
for e.g.
 
XML 1:
 <catalog>
   <book id="bk101">
   <author>Gambardella, Matthew</author>
   <title>XML Developer's Guide</title>
   <genre>Computer</genre>
   <price>44.95</price>
  </book>
</catalog>
 
XML 2:
<catalog>
   <book id="bk102">
   <author>Ralls, Kim</author>
   <title>Midnight Rain</title>
   <genre>Fantasy</genre>
   <price>5.95</price>
   </book>
</catalog>
 
 Result needed xml1 and xml2 concatenate to one :
 
<?xml version="1.0"?>
<catalogs>
   <catalog>
      <book id="bk101">
      <author>Gambardella, Matthew</author>
      <title>XML Developer's Guide</title>
      <genre>Computer</genre>
      <price>44.95</price>
      </book>
   </catalog>
   <catalog>
      <book id="bk102">
      <author>Ralls, Kim</author>
      <title>Midnight Rain</title>
      <genre>Fantasy</genre>
      <price>5.95</price>
      </book>
   </catalog>
</catalogs>
 
 Thanks 

Answers (1)