Thumbs up ! 
Thanks Matt. 

On Wednesday, July 26, 2017 at 4:42:24 AM UTC+2, Matt Harden wrote:
>
> The decoder will actually accumulate the pages for you, so you only need 
> one Foo: https://play.golang.org/p/VDZvoJaSZW
>
> On Tue, Jul 25, 2017 at 6:56 AM <alexandr...@gmail.com <javascript:>> 
> wrote:
>
>> I change some structs so now it works as expected.
>> Here's the playground: https://play.golang.org/p/DXlajwirtt
>>  
>>
>> On Tuesday, July 25, 2017 at 2:42:41 PM UTC+2, Alex L wrote:
>>>
>>> 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...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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