Hi Everyone - I am having difficulties outputting my parsed XML. (Data feed
from flightstats.com)
It is probably something to do with the syntax of "noname namespace" - I have
no idea what that means but I found some comments on it on Steven Erats blog
that fixed my initial reading of the file... But I am still having issues with
outputting the data.
The error I recieve is:
Element AIRLINE.XMLATTRIBUTES.AIRLINECODE is undefined in MYXML.
However - that "element" is there - I think I am just calling it wrong.
Please help! Thank you!
- Nick
Code:
<cfset mydoc = XmlParse(CFHTTP.FileContent)>
<cfset myFlights =
xmlSearch(mydoc,'/:FlightHistoryGetRecordsResponse/:FlightHistory')>
<cfset numFlights =
"#ArrayLen(xmlSearch(mydoc,'/:FlightHistoryGetRecordsResponse/:FlightHistory'))#">
<cfoutput>ArrayLen:: #numFlights#</cfoutput>
<h1>Data List Begin</h1>
<ol>
<cfoutput>
<cfloop from="1" to="#numFlights#" index="i">
<cfset myXML = xmlparse(myFlights[i])>
<li>
<b>ID:</b> #myXML.Airline.XmlAttributes.AirlineCode# :::
</li>
</cfloop>
</cfoutput>
</ol>
XML snipet as follows:
<?xml version="1.0" encoding="UTF-8"?>
<FlightHistoryGetRecordsResponse
xmlns="http://pathfinder-xml/FlightHistoryService.xsd">
<FlightHistory DepartureAirportTimeZoneOffset="-5"
ArrivalAirportTimeZoneOffset="-5" ActualAirTime="88"
ActualRunwayArrivalDate="2012-07-31T14:10:00.000"
ActualRunwayDepartureDate="2012-07-31T12:42:00.000"
ArrivalDate="2012-07-31T13:03:00.000" CreatorCode="A"
DepartureDate="2012-07-31T11:29:00.000"
EstimatedRunwayArrivalDate="2012-07-31T14:06:00.000"
EstimatedRunwayDepartureDate="2012-07-31T12:41:00.000"
FlightHistoryId="270615028" FlightNumber="3265" ScheduledAirTime="94"
ScheduledRunwayArrivalDate="2012-07-31T13:03:00.000"
ScheduledRunwayDepartureDate="2012-07-31T11:29:00.000" Status="Landed"
StatusCode="L">
<Airline AirlineCode="9E" IATACode="9E" ICAOCode="FLG" Name="Pinnacle
Airlines"/>
<Origin AirportCode="CWA" FAACode="CWA" IATACode="CWA" ICAOCode="KCWA"
Name="Central Wisconsin Airport"/>
<Destination AirportCode="MEM" FAACode="MEM" IATACode="MEM" ICAOCode="KMEM"
Name="Memphis International Airport"/>
</FlightHistory>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive:
http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:5872
Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-newbie/unsubscribe.cfm