t76.php
<?php
header('Content-Type:text/xml');
?>
<employees>
<employee id="1">
<name>zhang da shan</name>
<email>sansan@163.com</email>
<mobile_phone>11612345678</mobile_phone>
<department>shi chang bu</department>
</employee>
<employee id="2">
<name>li tao tao</name>
<email>taotao@126.com</email>
<mobile_phone>13812345678</mobile_phone>
<department>yan fa bu</department>
</employee>
<employee id="3">
<name>wang lao hu</name>
<email>laohu@sina.com</email>
<mobile_phone>12312345678</mobile_phone>
<department>xing zheng bu</department>
</employee>
</employees>
t77.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:spry="http://ns.adobe.com/spry">
<head>
<meta http-equiv="Content-Type" content="text/xml; charset=utf-8" />
//引入spry框架
<script type="text/javascript" src="Spry_1_6/includes/xpath.js"></script>
//引入spry数据集
<script type="text/javascript" src="Spry_1_6/includes/SpryData.js"></script>
<title>spry to xml</title>
//脚本
<script type="text/javascript">
var ds1 = new Spry.Data.XMLDataSet("t76.php","employees/employee");
</script>
</head>
<body>
<span>shi yong spry xian shi xml shu ju</span>
<hr>
xian shi shu ju ru xia:
<br>
<br>
//绑定区域
<div spry:region="ds1">
<table cellpadding="3" border="1">
<tr>
<th>name</th>
<th>email</th>
<th>mobile_phone</th>
<th>department</th>
</tr>
//绑定数据
<tr spry:repeat="ds1">
<td>{name}</td>
<td>{email}</td>
<td>{mobile_phone}</td>
<td>{department}</td>
</tr>
</table>
</div>
</body>
</html>
请自行下载spry v1.6 框架,放置在代码的根目录。