Hi,
I'm new to Go, and this is my first post here...

I need to merge some xml files into 1.
I would prefer using standard library for this task.

var XML1 = []byte(`<?xml version="1.0" encoding="UTF-8"?>
<Foo>
   <Document>
      <Info>some stuff</Info>
      <Pages>
        <Page number="1">
         <tag>abc</tag>
        </Page>
        <Page number="2">
         <tag>def</tag>
        </Page>
      </Pages>
   </Document>
</Foo>`)

var XML2 = []byte(`<?xml version="1.0" encoding="UTF-8"?>
<Foo>
   <Document>
      <Info>some stuff</Info>
      <Pages>
        <Page number="1">
         <tag>ghi</tag>
        </Page>
        <Page number="2">
         <tag>jkl</tag>
        </Page>
      </Pages>
   </Document>
</Foo>`)


Result I'm looking for would be:

<?xml version="1.0" encoding="UTF-8"?>
<Foo>
   <Document>
      <Info>some stuff</Info>
      <Pages>
        <Page number="1">
         <tag>ghi</tag>
        </Page>
        <Page number="2">
         <tag>jkl</tag>
        </Page>

        <Page number="3">
         <tag>ghi</tag>
        </Page>
        <Page number="4">
         <tag>jkl</tag>
        </Page>

</Pages>
</Document>
</Foo>


Here's what I have done so far: https://play.golang.org/p/xzqhhURV46

Thanks.


-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to