tags:

views:

108

answers:

1

Hello.

I have this in my XML file:

<product name="iphone">
    <variant name="iphone" product_number="12345" price="500" picture="iphone.jpg">
        <description><![CDATA[iphone]]></description>
        <short_description><![CDATA[]]></short_description>
        <deliverytime><![CDATA[]]></deliverytime>
        <options>
            <option group="Color" option="Black" />
        </options>
    </variant>
</product>
<product name="iphone">
    <variant name="iphone" product_number="12345" price="500" picture="iphone.jpg">
        <description><![CDATA[iphone]]></description>
        <short_description><![CDATA[]]></short_description>
        <deliverytime><![CDATA[]]></deliverytime>
        <options>
            <option group="Color" option="White" />
        </options>
    </variant>
</product>

I want to merge it into this (Note that I merge the options tag):

<product name="iphone">
    <variant name="iphone" product_number="12345" price="500" picture="iphone.jpg">
        <description><![CDATA[iphone]]></description>
        <short_description><![CDATA[]]></short_description>
        <deliverytime><![CDATA[]]></deliverytime>
        <options>
            <option group="Color" option="Black" />
            <option group="Color" option="White" />
        </options>
    </variant>
</product>

Preferably I want to do it all in the memory since I will process it further afterwards.

A: 
rokdd