# Building this array from XML

**URL:** https://forum.kirupa.com/t/building-this-array-from-xml/192275
**Category:** flash
**Created:** [June 27, 2006, 12:04pm UTC](https://forum.kirupa.com/t/building-this-array-from-xml/192275 "2006-06-27T12:04:38Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Ferdi](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/ferdi/32/689_2.png) [@Ferdi](https://forum.kirupa.com/u/Ferdi)
#### Post date: [June 27, 2006, 12:04pm UTC](https://forum.kirupa.com/t/building-this-array-from-xml/192275/1 "2006-06-27T12:04:38Z")

</div>

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:

```php

<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
