I am using xpath to pare and pull certain data from a xml file.
<?php
$dom = new DOMDocument();
$xpath = new DOMXPath($dom);
$reader = new XMLReader();
$reader->open($xmlurl);
while ($reader->read()) {
if ($reader->nodeType == XMLReader::ELEMENT && $reader->name == 'Hotel') {
$node = $dom->importNode($reader->expand(), true);
$dom->appendChild($node);
$lat = $xpath->evaluate('string(self::Hotel[HotelCode = "'.$hotelCodes[1].'"]/Latitude)', $node);
$dom->removeChild($node);
if ($lat) {
echo $lat;
}
}
}
?>
How can i store the $lat variable and echo it on another side of the page ?
No comments:
Post a Comment