actionscript 3 - getting value from a list -
i have xml looks this:
<?xml version="1.0" encoding="utf-8"?> <feed xmlns="http://www.w3.org/2005/atom" version="1.0" xml:lang="en"> <title type="text">google hot trends</title> <subtitle type="text">what people searching on google today?</subtitle> <id>http://www.google.com/trends/hottrends/atom/hourly,2007-08</id> <link href="http://www.google.com/trends/hottrends/atom/hourly" rel="self"/> <updated>2010-12-01t14:03:30z</updated> <entry xmlns="http://www.w3.org/2005/atom"> <id>2010-12-01t14:03:30z</id> <title type="text"><![cdata[rosa parks, adam levine girlfriend, meet famous, ...]]></title> <content type="html"><![cdata[<ol> <li><span class="mild up2"><a href="http://www.google.com/trends/hottrends?q=rosa+parks&date=2010-12-1&sa=x">rosa parks</a></span></li> <li><span class="mild down1"><a href="http://www.google.com/trends/hottrends?q=adam+levine+girlfriend&date=2010-12-1&sa=x">adam levine girlfriend</a></span></li> <li><span class="mild down1"><a href="http://www.google.com/trends/hottrends?q=meet+the+famous&date=2010-12-1&sa=x">meet famous</a></span></li> <li><span class="mild equal"><a href="http://www.google.com/trends/hottrends?q=sons+of+anarchy+season+4&date=2010-12-1&sa=x">sons of anarchy season 4</a></span></li> <li><span class="mild equal"><a href="http://www.google.com/trends/hottrends?q=victoria+secret+angels&date=2010-12-1&sa=x">victoria secret angels</a></span></li> <li><span class="mild up5"><a href="http://www.google.com/trends/hottrends?q=happy+hanukkah&date=2010-12-1&sa=x">happy hanukkah</a></span></li> <li><span class="mild down1"><a href="http://www.google.com/trends/hottrends?q=katy+perry+victoria+secret+fashion+show&date=2010-12-1&sa=x">katy perry victoria secret fashion show</a></span></li> <li><span class="mild down1"><a href="http://www.google.com/trends/hottrends?q=married+to+the+mob+clothing&date=2010-12-1&sa=x">married mob clothing</a></span></li> <li><span class="mild down1"><a href="http://www.google.com/trends/hottrends?q=victoria+secret+models+names+and+pictures&date=2010-12-1&sa=x">victoria secret models names , pictures</a></span></li> <li><span class="mild equal"><a href="http://www.google.com/trends/hottrends?q=world+aids+day+2010&date=2010-12-1&sa=x">world aids day 2010</a></span></li> <li><span class="mild up6"><a href="http://www.google.com/trends/hottrends?q=shahla+jahed&date=2010-12-1&sa=x">shahla jahed</a></span></li> <li><span class="mild equal"><a href="http://www.google.com/trends/hottrends?q=interpol&date=2010-12-1&sa=x">interpol</a></span></li> <li><span class="mild up18"><a href="http://www.google.com/trends/hottrends?q=wallis+simpson&date=2010-12-1&sa=x">wallis simpson</a></span></li> <li><span class="mild up46"><a href="http://www.google.com/trends/hottrends?q=chanukah&date=2010-12-1&sa=x">chanukah</a></span></li> <li><span class="mild new"><a href="http://www.google.com/trends/hottrends?q=hiv+symptoms&date=2010-12-1&sa=x">hiv symptoms</a></span></li> <li><span class="mild up6"><a href="http://www.google.com/trends/hottrends?q=santa+tracker&date=2010-12-1&sa=x">santa tracker</a></span></li> <li><span class="mild down8"><a href="http://www.google.com/trends/hottrends?q=vs+fashion+show+2010&date=2010-12-1&sa=x">vs fashion show 2010</a></span></li> <li><span class="mild down3"><a href="http://www.google.com/trends/hottrends?q=advent+calendar&date=2010-12-1&sa=x">advent calendar</a></span></li> <li><span class="mild up8"><a href="http://www.google.com/trends/hottrends?q=december+1&date=2010-12-1&sa=x">december 1</a></span></li> <li><span class="mild up19"><a href="http://www.google.com/trends/hottrends?q=aids+ribbon&date=2010-12-1&sa=x">aids ribbon</a></span></li> </ol> ]]></content></entry></feed>
how able values <a>
tags inside <li>
tags?
what can if <content>
formed , transform in xml
, use e4x
query informations wanted.
you have 1 more thing carefull xml
contains namespace
content node have take care of that. suggest reading post xml here example.
so content
node inside entry
node have namespace
, 's same root node can reuse same namespace
:
var xml:xml=<feed xmlns="http://www.w3.org/2005/atom" version="1.0" xml:lang="en"> <title type="text">google hot trends</title> <subtitle type="text">what people searching on google today?</subtitle> <id>http://www.google.com/trends/hottrends/atom/hourly,2007-08</id> <link href="http://www.google.com/trends/hottrends/atom/hourly" rel="self"/> <updated>2010-12-01t14:03:30z</updated> <entry xmlns="http://www.w3.org/2005/atom"> <id>2010-12-01t14:03:30z</id> <title type="text"><![cdata[rosa parks, adam levine girlfriend, meet famous, ...]]></title> <content type="html"><![cdata[<ol> <li><span class="mild up2"><a href="http://www.google.com/trends/hottrends?q=rosa+parks&date=2010-12-1&sa=x">rosa parks</a></span></li> <li><span class="mild down1"><a href="http://www.google.com/trends/hottrends?q=adam+levine+girlfriend&date=2010-12-1&sa=x">adam levine girlfriend</a></span></li> <li><span class="mild down1"><a href="http://www.google.com/trends/hottrends?q=meet+the+famous&date=2010-12-1&sa=x">meet famous</a></span></li> <li><span class="mild equal"><a href="http://www.google.com/trends/hottrends?q=sons+of+anarchy+season+4&date=2010-12-1&sa=x">sons of anarchy season 4</a></span></li> <li><span class="mild equal"><a href="http://www.google.com/trends/hottrends?q=victoria+secret+angels&date=2010-12-1&sa=x">victoria secret angels</a></span></li> <li><span class="mild up5"><a href="http://www.google.com/trends/hottrends?q=happy+hanukkah&date=2010-12-1&sa=x">happy hanukkah</a></span></li> <li><span class="mild down1"><a href="http://www.google.com/trends/hottrends?q=katy+perry+victoria+secret+fashion+show&date=2010-12-1&sa=x">katy perry victoria secret fashion show</a></span></li> <li><span class="mild down1"><a href="http://www.google.com/trends/hottrends?q=married+to+the+mob+clothing&date=2010-12-1&sa=x">married mob clothing</a></span></li> <li><span class="mild down1"><a href="http://www.google.com/trends/hottrends?q=victoria+secret+models+names+and+pictures&date=2010-12-1&sa=x">victoria secret models names , pictures</a></span></li> <li><span class="mild equal"><a href="http://www.google.com/trends/hottrends?q=world+aids+day+2010&date=2010-12-1&sa=x">world aids day 2010</a></span></li> <li><span class="mild up6"><a href="http://www.google.com/trends/hottrends?q=shahla+jahed&date=2010-12-1&sa=x">shahla jahed</a></span></li> <li><span class="mild equal"><a href="http://www.google.com/trends/hottrends?q=interpol&date=2010-12-1&sa=x">interpol</a></span></li> <li><span class="mild up18"><a href="http://www.google.com/trends/hottrends?q=wallis+simpson&date=2010-12-1&sa=x">wallis simpson</a></span></li> <li><span class="mild up46"><a href="http://www.google.com/trends/hottrends?q=chanukah&date=2010-12-1&sa=x">chanukah</a></span></li> <li><span class="mild new"><a href="http://www.google.com/trends/hottrends?q=hiv+symptoms&date=2010-12-1&sa=x">hiv symptoms</a></span></li> <li><span class="mild up6"><a href="http://www.google.com/trends/hottrends?q=santa+tracker&date=2010-12-1&sa=x">santa tracker</a></span></li> <li><span class="mild down8"><a href="http://www.google.com/trends/hottrends?q=vs+fashion+show+2010&date=2010-12-1&sa=x">vs fashion show 2010</a></span></li> <li><span class="mild down3"><a href="http://www.google.com/trends/hottrends?q=advent+calendar&date=2010-12-1&sa=x">advent calendar</a></span></li> <li><span class="mild up8"><a href="http://www.google.com/trends/hottrends?q=december+1&date=2010-12-1&sa=x">december 1</a></span></li> <li><span class="mild up19"><a href="http://www.google.com/trends/hottrends?q=aids+ribbon&date=2010-12-1&sa=x">aids ribbon</a></span></li> </ol> ]]></content></entry></feed>; // current namespace xml var ns:namespace = xml.namespace(); // , create new xml content node using previous namespace var contentxml:xml = new xml(xml.ns::entry.ns::content.tostring()); // node var anchors:xmllist = contentxml.li.span.a; // want values each (var anchor:xml in anchors) trace(anchor.@href);
Comments
Post a Comment