I've got some xml like this:
<flights>
<flight>
<flightno>BE145</flightno>
<origin>NCL</origin>
<destination>SOU</destination>
<departures>
<departure>
<departdate>03-10-2005</departdate>
<departtime>08:55</departtime>
</departure>
<flighttime>100</flighttime>
<capacity>12</capacity>
<operator>flybe</operator>
<costprice>30.00</costprice>
</flight>
</flights>
And I want to select all of the departure dates and times where the flight number = BE567 for example.
I've got this expression so far:
/flights/flight/flightno[.= "BE145"]/departures/departure
But it doesn't seem to generate any results.
If your interested I'm using:
// Execute the query and return a DOMNodeList
$entries = $xpath->query($qry);
foreach($entries as $entry)
{
$depdate[$i] = $entry->nodeValue;
$deptime[$i] = $entry->nextSibling->nodeValue;
$i++;
}
To set the results and:
//print the departures that are available
for($i=0;$i<sizeof($depdate);$i++)
{
echo $depdate[$i]."<br />".$deptime[$i]."<p />";
}
to print things out.