Building this array from XML

Hi all,

I’m trying to dynamically build this structure from my XML file:

[[“Operator1”,“Price”],[“PhoneBrand1”,“PhoneType1”,“PhoneType2”],[“PhoneBrand2”,“PhoneType1”,“PhoneType2”]],
[[“Operator2”,“Price”],[“PhoneBrand1”,“PhoneType1”,“PhoneType2”],[“PhoneBrand2”,“PhoneType1”,“PhoneType2”]]

This is my XML file:


<operators>
    <operator name="Operator1">
        <price>3</price>
        <brands>
            <brand name="PhoneBrand1">
                <type>PhoneType1</type>
                <type>PhoneType2</type>
            </brand>
            <brand name="PhoneBrand2">
                <type>PhoneType1</type>
                <type>PhoneType2</type>
            </brand>
        </brands>
    </operator>
    <operator name="Operator2">
        <price>6</price>
        <brands>
            <brand name="PhoneBrand1">
                <type>PhoneType1</type>
                <type>PhoneType2</type>
            </brand>
            <brand name="PhoneBrand2">
                <type>PhoneType1</type>
                <type>PhoneType2</type>
                <type>PhoneType3type>
            </brand>
        </brands>
    </operator>
</operators>

Now I know how to parse the XML file, but I’m just confused how I should build the array described above using this XML file.

Could anyone please help me? Would be very much appreciated.
Thanks in advance,

Ferdi