# Reading XML (Video Link)

**URL:** <https://forum.kirupa.com/t/reading-xml-video-link/332315>\
**Category:** flash\
**Created:** [April 14, 2014, 7:18pm UTC](https://forum.kirupa.com/t/reading-xml-video-link/332315 "2014-04-14T19:18:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nightkarnation](https://avatars.discourse-cdn.com/v4/letter/n/a5b964/32.png) [@nightkarnation](https://forum.kirupa.com/u/nightkarnation)\
**Post date:** [April 14, 2014, 7:18pm UTC](https://forum.kirupa.com/t/reading-xml-video-link/332315/1 "2014-04-14T19:18:52Z")

</div>

Hey guys, I am a noob loading xml data and I already got some help here reading some xml, I am stuck again (tried already with what I learnt) with a different type of reading, I need to retrieve the following information:

Here’s the important/related part of the AS3:

```auto

var data:XML = new XML(loader.data as String);
            var status:String = data.*::status.toString();

            if ( status == "success" )
            {
                trace("SUCCESS");
                var ad:XMLList = data.*::ads.*::ad;
                var link:String = ad.*::link.toString();
                trace("DATA: " + data);
                trace("AD: " + ad);
                trace("TEST AD TYPE: " + ad.@type);
                trace("LINK: " + link);
                trace("TEXT: " + ad.*::adtext.toString());
                trace("VIDEO LINK: " + ad.*::mediafiles.toString()); // <---- grabbing the Video URL I need, but also grabbing some extra data I don't really need.

```

And now, here’s the trace from DATA, so you can see the whole loaded xml and suggest how I can go about and trace only the URL under mediafiles

```auto

DATA: <response xsi:schemaLocation="http://soma.smaato.com/oapi/ http://www.smaato.com/definitions/xsd/smaatoapi_v2.xsd" xmlns="http://soma.smaato.com/oapi/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <sessionid>C7363E223B2F272F088E0191B351FC2B.ip-10-0-32-69</sessionid>
  <status>success</status>
  <user>
    <id>900</id>
    <ownid/>
  </user>
  <ads>
    <ad id="0" type="VIDEO" width="640" height="360">
      <log-id/>
      <valid start="0" end="0" max="1"/>
      <mediafiles>
        <mediafile delivery=" " bitrate="">http://smaato-ads.s3.amazonaws.com/1340012129241.mp4</mediafile>
      </mediafiles>

```

NOTE: this is what Video Link trace is tracing right now:

```auto

<mediafiles xmlns="http://soma.smaato.com/oapi/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <mediafile delivery=" " bitrate="">http://smaato-ads.s3.amazonaws.com/1340012129241.mp4</mediafile>
</mediafiles>

```

Thanks again in advance!
