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:
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
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:
<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!