My xml stream is as follows, and I want to programmatically
determine if it contains the <cpData> tag. How can I do this via the
XMLList.contains() method?
<socFlight>
<cp dataValue="3*" severity="5"/>
<cpflt dataValue="HOTL" severity="5"/>
<cpfrm dataValue="STL" severity="0"/>
<fa dataValue="7" severity="11"/>
<faflt dataValue="ORIG" severity="11"/>
<fafrm dataValue=" " severity="0"/>
<tp dataValue="767" severity="0"/>
<ac dataValue="367" severity="11"/>
<acfrm dataValue="0962/19" severity="5"/>
<acfrmsta dataValue="GRU" severity="5"/>
<flt dataValue="0005/20" severity="11"/>
<sta dataValue="HNL" severity="11"/>
<skd dataValue="200607201005" severity="11"/>
<lat dataValue="200607201005" severity="11"/>
<prj dataValue="200607201005" severity="11"/>
<acarvtime dataValue="200607200606" severity="5"/>
<cparvtime dataValue="200607192133" severity="0"/>
<faarvtime dataValue=" " severity="0"/>
<arvstatus dataValue="I" severity="5"/>
<acskedarvtime dataValue="200607200605" severity="5"/>
<aclatestarvtime dataValue="200607200606" severity="5"/>
<arvpax dataValue="/0" severity="5"/>
<depstatus dataValue="S" severity="11"/>
<deppax dataValue="214/0" severity="11"/>
<cparvstatus dataValue="P" severity="0"/>
<cpfltstatus dataValue="X" severity="0"/>
<faarvstatus dataValue=" " severity="0"/>
<fafltstatus dataValue=" " severity="0"/>
<fltstatus dataValue=" " severity="0"/>
<checktype dataValue=" " severity="0"/>
<checkdate dataValue=" " severity="0"/>
<equipment dataValue="767C" severity="0"/>
<intconn dataValue=" " severity="0"/>
<domconn dataValue=" " severity="0"/>
<cpData>
<crewData arrivalStatus="P" crewCount="2" fromDepSta="STL"
fromFlightNumber="1485" latestArrivalTime="200607192133"/>
<crewData crewCount="1" fromFlightNumber="ORIG"/>
</cpData>
<inboundintconn dataValue=" " severity="0"/>
<inbounddomconn dataValue=" " severity="0"/>
<inboundarvgate dataValue="D30" severity="0"/>
<depgate dataValue="D30" severity="0"/>
</socFlight>
and my attempt at some source code that isn't working:
public function generateCPMouseOver(data:Object,
myListData:DataGridListData):String {
var xmlData:XML = XML(data);
var elems:XMLList = xmlData.elements();
var children:XMLList = xmlData.children();
var item:XML;
var found:Boolean = false;
for each(item in elems) {
trace("item: " + item.toXMLString());
var attribs:XMLList = item.attributes();
if (item.contains("<cpData>")) found=true;
}
return found.toString();
}
and the output:
item: <cp dataValue="3*" severity="5"/>
item: <cpflt dataValue="HOTL" severity="5"/>
item: <cpfrm dataValue="STL" severity="0"/>
item: <fa dataValue="7" severity="11"/>
item: <faflt dataValue="ORIG" severity="11"/>
item: <fafrm dataValue=" " severity="0"/>
item: <tp dataValue="767" severity="0"/>
item: <ac dataValue="367" severity="11"/>
item: <acfrm dataValue="0962/19" severity="5"/>
item: <acfrmsta dataValue="GRU" severity="5"/>
item: <flt dataValue="0005/20" severity="11"/>
item: <sta dataValue="HNL" severity="11"/>
item: <skd dataValue="200607201005" severity="11"/>
item: <lat dataValue="200607201005" severity="11"/>
item: <prj dataValue="200607201005" severity="11"/>
item: <acarvtime dataValue="200607200606" severity="5"/>
item: <cparvtime dataValue="200607192133" severity="0"/>
item: <faarvtime dataValue=" " severity="0"/>
item: <arvstatus dataValue="I" severity="5"/>
item: <acskedarvtime dataValue="200607200605" severity="5"/>
item: <aclatestarvtime dataValue="200607200606" severity="5"/>
item: <arvpax dataValue="/0" severity="5"/>
item: <depstatus dataValue="S" severity="11"/>
item: <deppax dataValue="214/0" severity="11"/>
item: <cparvstatus dataValue="P" severity="0"/>
item: <cpfltstatus dataValue="X" severity="0"/>
item: <faarvstatus dataValue=" " severity="0"/>
item: <fafltstatus dataValue=" " severity="0"/>
item: <fltstatus dataValue=" " severity="0"/>
item: <checktype dataValue=" " severity="0"/>
item: <checkdate dataValue=" " severity="0"/>
item: <equipment dataValue="767C" severity="0"/>
item: <intconn dataValue=" " severity="0"/>
item: <domconn dataValue=" " severity="0"/>
item: <cpData>
<crewData arrivalStatus="P" crewCount="2" fromDepSta="STL"
fromFlightNumber="1485" latestArrivalTime="200607192133"/>
<crewData crewCount="1" fromFlightNumber="ORIG"/>
</cpData>
item: <inboundintconn dataValue=" " severity="0"/>
item: <inbounddomconn dataValue=" " severity="0"/>
item: <inboundarvgate dataValue="D30" severity="0"/>
item: <depgate dataValue="D30" severity="0"/>
------------------------ Yahoo! Groups Sponsor --------------------~-->
Check out the new improvements in Yahoo! Groups email.
http://us.click.yahoo.com/6pRQfA/fOaOAA/yQLSAA/nhFolB/TM
--------------------------------------------------------------------~->
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/