Home  >  Article  >  Backend Development  >  XML Guide - XML ​​Data Island

XML Guide - XML ​​Data Island

黄舟
黄舟Original
2017-02-11 15:20:371612browse

Using IE5.0 or higher, XML data can be embedded in HTML pages in the form of data islands.
Embedding XML data in HTML pages
Xml data can be embedded into HTML pages using the unofficial standard b2a0af5a8fd26276da50279a1c63a57a tag.
XML data can be embedded in an HTML page like the following example:

<xml id="note">    
<note>    
<to>Tove</to>    
<from>Jani</from>    
<heading>Reminder</heading>    
<body>Don&#39;t forget me this weekend!</body>    
</note>    
</xml>


or embedded in an external separate XML file like the following:

<xml id="note" src="note.xml">  
</xml>


Note that the b2a0af5a8fd26276da50279a1c63a57a tag is an HTML element, not an XML element.



Data binding
XML data islands can be bound to HTML elements (such as tables).
In the following example, an XML data island (ID=cdcat) is loaded from an external XML document. An HTML table is bound to this data island. The span element inside the HTML table uses the datafld attribute to bind to the corresponding XML element of the XML document.

<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>

The above is the content of XML Guide-XML Data Island. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn