I'm trying to import xml data into Flash.
This works:
var xmlLoader:URLLoader = new URLLoader();
var xmlData:XML = new XML();
xmlLoader.addEventListener(Event.COMPLETE, LoadXML);
xmlLoader.load(new URLRequest("http://www.pachube.com/api/feeds/2356.xml"));
function LoadXML(e:Event):void {
xmlData = new XML(e.target.data);
ParseFeed(xmlData);
}
function ParseFeed(feedInput:XML):void {
trace("XML Output");
trace("------------------------");
trace(feedInput);
}
but when I try to filter by node, I don't get any output at all.
For instance, I thought using this
trace(feedInput.description.data);
would result in displaying only the data element, but it results in no info
at all being displayed via trace. Variations result in the same. I'm not a
programmer, and I think I must be misunderstanding the structure. I tried to
follow this guide:
http://www.kirupa.com/developer/flashcs3/using_xml_as3_pg3.htm
Ultimately my objective is to *only retrieve the value in the data value
element.* (42.0 in the example below)
Thanks for any help.
Tori
This is the xml file structure:
<eeml version="5" xsi:schemaLocation="http://www.eeml.org/xsd/005
http://www.eeml.org/xsd/005/005.xsd" xmlns="http://www.eeml.org/xsd/005"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<environment updated="2009-11-10T01:38:00Z" id="2356" creator="
http://www.haque.co.uk">
<title>Cat bed</title>
<feed>http://www.pachube.com/api/feeds/2356.xml</feed>
<status>live</status>
<description>Experimental feed which detects whether my cats are on the
catbed. Any number over 10 indicates a positive reading. :)</description>
<location domain="physical" exposure="indoor" disposition="fixed">
<name>Austin</name>
<lat>30.3121938136654</lat>
<lon>-97.7255880832672</lon>
</location>
<data id="0">
<tag>catbed</tag>
<tag>analogRead0</tag>
<tag>analogRead2</tag>
<tag>pressure sensor</tag>
<tag>cat bed</tag>
<value minValue="0.0" maxValue="312.0">42.0</value>
<unit/>
</data>
</environment>
</eeml>
--~--~---------~--~----~------------~-------~--~----~
Our Web site: http://www.RefreshAustin.org/
You received this message because you are subscribed to the Google Groups
"Refresh Austin" group.
[ Posting ]
To post to this group, send email to [email protected]
Job-related postings should follow http://tr.im/refreshaustinjobspolicy
We do not accept job posts from recruiters.
[ Unsubscribe ]
To unsubscribe from this group, send email to
[email protected]
[ More Info ]
For more options, visit this group at
http://groups.google.com/group/Refresh-Austin
-~----------~----~----~----~------~----~------~--~---