Matching employees with name 'Laura Pollard'
";
$employees = $xml->xpath('/employees/employee[name="'.$_GET['name'].'"]');
foreach($employees as $employee) {
echo "Found {$employee->name}
";
}
echo "
";
echo "Matching employees younger than 54
";
$employees = $xml->xpath('/employees/employee[age<54]');
foreach($employees as $employee) {
echo "Found {$employee->id}
";
}
echo "
";
echo "Matching employees as old or older than 48
";
$age = $_POST['age'];
$employees = $xml->xpath('//employee[age>='.$age.']');
foreach($employees as $employee) {
echo "Found {$employee->age}
";
}
echo "
";
?>
load('coffee.xml');
$xpath = new DOMXPath($doc);
$query = "/Coffees/Coffee[@ID='".$_POST['search']."']";
#$result = isset($xpath->query($query)) ? $xpath->query($query) : '';
$result = $xpath->query($query);
}
?>