# Loading data into an array from an XML file

**URL:** <https://forum.kirupa.com/t/loading-data-into-an-array-from-an-xml-file/317748>\
**Category:** flash\
**Created:** [January 1, 2011, 9:34am UTC](https://forum.kirupa.com/t/loading-data-into-an-array-from-an-xml-file/317748 "2011-01-01T09:34:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![milad7](https://avatars.discourse-cdn.com/v4/letter/m/977dab/32.png) [@milad7](https://forum.kirupa.com/u/milad7)\
**Post date:** [January 1, 2011, 9:34am UTC](https://forum.kirupa.com/t/loading-data-into-an-array-from-an-xml-file/317748/1 "2011-01-01T09:34:09Z")

</div>

Hi there,

I am trying to make a dynamic diagram and load the data from an XML file.  
So there are going to be a box for each tittle and there are going to be connected with a line.  
Link function connects p\_from to p\_to ,now I am trying to load the data from an XML file.(A1 =\> A2 =\>A3 )

```auto

var links: Array = new Array();
function Link(p_from: String, p_to: String) {
    if (links[p_from] == undefined) links[p_from] = new Array();
    links[p_from][p_to] = true;
};
                
Link("A1, "A2");
Link("A2", "A3");

```

I tried to use the following code but it doesn’t work.I would appreciate it if you can help.Thanks

```auto

var links: Array = new Array();
function Link(p_from: String, p_to: String) {
    if (links[p_from] == undefined) links[p_from] = new Array();
    links[p_from][p_to] = true;
};
var cats_xml = new XML();
                cats_xml.onLoad = function(loaded){
    }
                }
                
Link(parent.childNodes[0].childNodes[0],parent.childNodes[0].childNodes[1]);
Link(parent.childNodes[0].childNodes[1], "A3");

                cats_xml.load("A.xml");

```

A.xml:

```auto

<A's>
                <title1>
                A1
                </title>
                <title2>
                A2
                </title2>
<A's>

```
