使用ie5.0或者更高的版本,xml数据可以以数据岛的形式嵌入html页面。
在html页面中嵌入xml数据
使用非官方标准的b2a0af5a8fd26276da50279a1c63a57a标记可以将xml数据嵌入到html页面中。
xml数据可以象下面的例子那样嵌入html页面:
<xml id="note">    
<note>    
<to>tove</to>    
<from>jani</from>    
<heading>reminder</heading>    
<body>don't forget me this weekend!</body>    
</note>    
</xml>
或者象下面这样嵌入外部单独的xml文件:
<xml id="note" src="note.xml">  
</xml>
注意那个<xml>标记是一个html元素,而不是一个xml元素。
数据绑定
xml数据岛可以绑定到html元素上(比如表格)。
在下面的例子中,一个xml数据岛(id=cdcat)被从外部xml文档载入。一个html的表格绑定到此数据岛上。html表格内部的span元素使用datafld属性和xml文档相应的xml元素相互绑定。
<html>   
<body>   
<xml id="cdcat" src="cd_catalog.xml"></xml>   
<table border="1" datasrc="#cdcat">   
<tr>   
<td><span datafld="artist"></span></td>   
<td><span datafld="title"></span></td>   
</tr>   
</table>   
</body>   
</html>
以上就是xml指南——xml数据岛的内容。
   
 
   