# Xml/array puzzler

**URL:** <https://forum.kirupa.com/t/xml-array-puzzler/296436>\
**Category:** Uncategorized\
**Created:** [September 15, 2009, 3:55am UTC](https://forum.kirupa.com/t/xml-array-puzzler/296436 "2009-09-15T03:55:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tedri\_Mark](https://avatars.discourse-cdn.com/v4/letter/t/51bf81/32.png) [@Tedri\_Mark](https://forum.kirupa.com/u/Tedri_Mark)\
**Post date:** [September 15, 2009, 3:55am UTC](https://forum.kirupa.com/t/xml-array-puzzler/296436/1 "2009-09-15T03:55:19Z")

</div>

Hi all,

I’m trying to pull a URL from an xml file, but have come up against a problem that I cannot solve.

The XML looks like this:

```auto
<photos>
&#8722;
<photo>
<thumb src="http://www.videoemporiumdelivery.co.uk/test/images/fronts/5591.jpg"/>
<img src="http://www.videoemporiumdelivery.co.uk/test/images/backs/5591a.jpg"/>
<caption text="Angels and Demons"/>
<link src="http://www.imdb.com/find?s=tt&q=Angels+and+Demons&x=0&y=0"/>
&#8722;
<desc>
Tom Hanks returns as Da Vinci Code breaker Robert Langdon, this time saving the Catholic Church from a terrorist attack on the Vatican in Ron Howard's adaptation of the Dan Brown blockbuster.<br><br><a href="event:http://www.imdb.com/find?s=tt&q=Angels+and+Demons&x=0&y=0" rel="shadowbox"> More</a> 
</desc>
</photo>

```

or check it out here, if the formatting above has made it hard to read

[http://www.videoemporiumdelivery.co.uk/CodeIgniter/xml/justin](http://www.videoemporiumdelivery.co.uk/CodeIgniter/xml/justin)

I have this piece of code earlier on, which I believe, creates the array, :

```auto
{
                thumb* = dat.photos.photo.thumb.attributes()*;
                capt* = dat.photos.photo.caption.attributes()*;
                desc* = dat.photos.photo.desc.text()*;
                link* = dat.photos.photo.link.attributes()*;
                img* = dat.photos.photo.img.attributes()*;
            }

```

then I have a function which is executed when an image is clicked:

```auto
private function opentitlepage()
        
        {
            arguments;
            
        var myURL:URLRequest = new URLRequest(link[cID]);
        trace (link[cID]);
                navigateToURL(myURL,"blank");
        }

```

Which should obviously open up the URL within the ‘link’ attirbute of the xml

I put the trace in there to see if I could track down the problem, it is tracing ‘(link[cID])’ as 'undefined, which explains why it is not working.

However, if i change it to

```auto
var myURL:URLRequest = new URLRequest(img[cID]);

```

then clicking on the image opens in a new tab, as expected.

Then I changed that part back to how it was originally, and changed

```auto
link* = dat.photos.photo.link.attributes()*;

```

to

```auto
link* = dat.photos.photo.img.attributes()*;

```

and that gives me the same result, so I cannot undersatnd why it does not work for the link attribute in the xml?

I’m sure it’s something very simple I’m missing, can anyone help?
