# Reading XML

**URL:** <https://forum.kirupa.com/t/reading-xml/332304>\
**Category:** Uncategorized\
**Created:** [April 10, 2014, 11:00pm UTC](https://forum.kirupa.com/t/reading-xml/332304 "2014-04-10T23:00:27Z")\
**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 10, 2014, 11:00pm UTC](https://forum.kirupa.com/t/reading-xml/332304/1 "2014-04-10T23:00:27Z")

</div>

Hey guys, I am a noob loading xml data and 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("LINK: " + link);
 trace("AD TYPE: " + ???????) //<--- this is the line I need to correct. you will see below that it should trace "IMG"

```

Here’s the trace from DATA, so you can see the whole loaded data and suggest how I can go about and trace the TYPE under ADS / AD:

```auto

<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>5831058F8B711564A3BD69C9B1C0F3B3.ip-10-0-32-201</sessionid>
  <status>success</status>
  <user>
    <id>900</id>
    <ownid/>
  </user>
  <ads>
    <ad id="0" type="IMG" width="300" height="50">
      <log-id/>
      <valid start="0" end="0" max="1"/>
      <link>http://ec2-54-209-120-163.compute-1.amazonaws.com/oapi/getAd;jsessionid=5831058F8B711564A3BD69C9B1C0F3B3.ip-10-0-32-201</link>
      <action target="http://ec2-54-209-120-163.compute-1.amazonaws.com/oapi/clickAd;jsessionid=5831058F8B711564A3BD69C9B1C0F3B3.ip-10-0-32-201" acc="server"/>
      <adtextdescription>
        <descriptionline/>
      </adtextdescription>
      <beacons>
        <beacon>http://ec2-54-209-120-163.compute-1.amazonaws.com/oapi/getBeacon;jsessionid=5831058F8B711564A3BD69C9B1C0F3B3.ip-10-0-32-201</beacon>
      </beacons>
    </ad>
  </ads>
</response>

```

please don’t tell me that I already know it’s an IMG so I don’t need to trace it…the TYPE will change…  
Thanks a lot in advance!
