手册注释里有这么个例子:
  http://ca.php.net/manual/en/function.simplexml-element-xpath.phpxpath() can also be used to select elements by their attributes. For a good XPath reference check out: http://www.w3schools.com/xpath/xpath_syntax.asp<?php
$string = <<<XML
<sizes>
   <size label="Square" width="75" height="75" />
   <size label="Thumbnail" width="100" height="62" />
   <size label="Small" width="112" height="69" />
   <size label="Large" width="112" height="69" />
</sizes>
XML;
$xml = simplexml_load_string($string);
$result = $xml->xpath("//size[@label='Large']");// print the first (and only) member of the array
echo $result[0]->asXml();
?>The script would print: 
<size label="Large" width="112" height="69"/>