Source for file XML_XPath_example.php
Documentation is available at XML_XPath_example.php
// $Id: XML_XPath_example.php,v 1.3 2005/10/12 14:48:56 toggg Exp $
return ((float) $usec + (float) $sec);
require_once 'XML/XPath.php';
$string = '<?xml version="1.0"?>
$xml->load ($string, 'string');
echo '----------' . "\n";
/* Begin test for childNodes()
$children = $xml->childNodes();
echo 'Showing each child of <doc> (Please note blank nodes are skipped)' . "\n";
while ($children->next()) {
echo 'Index: ' . $children->getIndex() . ' Name: ' . $children->nodeName() . "\n";
echo '----------' . "\n";
$reports = $xml->evaluate ('//report[@id = "5"]');
echo 'The report title is: ' . $reports->substringData (0 , 0 , array ('.', 'title')) . "\n";
echo '----------' . "\n";
echo 'Here we want to generate a null pointer for an empty result misuse' . "\n";
echo '----------' . "\n";
$result = $xml->evaluate (array ('.', 'i/dont/exist'));
foreach (range(0 , 50 ) as $i) {
if ($reports->evaluate (array ('.', '..'), true )) {
echo $reports->nodeName ();
Documentation generated on Mon, 11 Mar 2019 14:44:42 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|