<!--PHP编程实战-->
<!--XML -->
<!--14-10-->
<!--使用XPath匹配属性值-->
<?php
error_reporting(E_ALL);
$xml = simplexml_load_file("template.xhtml");
$content = $xml->xpath("//*[@id='main_center']");
print (String)$content[0];
?>
知识点
使用了查询//*[@id='main_center']来找出属性id等于'main_center'的元素.