1
Reply

concatenate xmls in list to one xml

nc work

nc work

6 years ago
196
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)