Hi i have built an XML file to hold some flight details see below:
i've then used the following ASP to loop through each record:
which work fine, but now what i want to do is list each "code" attribute for the child "airline".
so for example it would just list BA, BA, CO, Co for the first record and the BA, BA, CO,Co for the 2nd etc...
I've tried using:
but this just list every airline child. any help will be of much help!
thanks
Ash
Code:
<?xml version="1.0"?>
<routes>
<route from="London Heathrow" to="New York" duration="07:30" >
<airline code="BA" aircraft="777"/>
<airline code="BA" aircraft="747-400"/>
<airline code="CO" aircraft="777"/>
<airline code="CO" aircraft="767-2000"/>
</route>
<route from="Edinburgh" to="New York" duration="08:55" via="LHR" transfer="02:00">
<airline code="BA" aircraft="777"/>
<airline code="BA" aircraft="747-400"/>
<airline code="CO" aircraft="777"/>
<airline code="CO" aircraft="767-2000"/>
</route>
<route from="Edinburgh" to="New York" duration="">
<airline code="CO" aircraft="757-200"/>
</route>
</routes>
i've then used the following ASP to loop through each record:
Code:
Response.Write "<table class='bluetable'>"
Response.Write "<tr><th>To:</th><th>From:</th><th>Via:</th><th>Approx Flight duration (hrs):</th><th>Approx transfer time (hrs):</th><th>Airline(s):</th><th>Comments:</th></tr>"
For Each route in objXML.documentElement.SelectNodes("/routes/route")
Response.Write "<tr><td>"
Response.Write route.GetAttribute("to")
Response.Write "</td>"
Response.Write "<td>"
Response.Write route.GetAttribute("from")
Response.Write "</td>"
Response.Write "<td>"
Response.Write route.GetAttribute("via")
Response.Write "</td>"
Response.Write "<td>"
Response.Write route.GetAttribute("duration")
Response.Write "</td>"
Response.Write "<td>"
Response.Write route.GetAttribute("transfer")
Response.Write "</td>"
Response.Write "<td>"
...
Next
....
which work fine, but now what i want to do is list each "code" attribute for the child "airline".
so for example it would just list BA, BA, CO, Co for the first record and the BA, BA, CO,Co for the 2nd etc...
I've tried using:
Code:
For Each airline in objXML.documentElement.SelectNodes("/routes/route/airline")
Response.Write airline.GetAttribute("code")
thanks
Ash