XML data island)

Source: Internet
Author: User

By using Internet Explorer, unofficial <XML> tags can be used to create XML data islands.

Embed XML data in HTML

XML data island is the XML data embedded in HTML.

Here we will demonstrate how it works. Suppose we have the following XML document ("note. xml "):

<? XML version = "1.0" encoding = "ISO-8859-1" ?>
< Note >
< To > Tove </ To >
< From > Jani </ From >
< Heading > Reminder </ Heading >
< Body > Don't forget me this weekend! </ Body >
</ Note >

Then, in the HTML document, you can use the <XML> tag to embed the above XML file. <XML> the tag ID attribute defines the ID of the data island, And the src attribute points to the embedded XML file:

< Html >
< Body >
< XML ID = "NOTE" SRC = "Note. xml" > </ XML >
</ Body >
</ Html >

However, the embedded XML data is invisible to users.

The next step is to bind the data island to an HTML element to format and display the data.

Bind data island to HTML elements

In the following example, we embed an XML file named "cd_catalog.xml" into the HTML file.

View "cd_catalog.xml ".

This is an HTML file:

< Html >
< Body >
< XML ID = "Cdcat" SRC = "Cd_catalog.xml" > </ XML >
< Table Border = "1" Datasrc = "# Cdcat" >
< Tr >
< TD > < Span Dataworks = "Artist" > </ Span > </ TD >
< TD > < Span Dataworks = "Title" > </ Span > </ TD >
</ Tr >
</ Table >
</ Body >
</ Html >

Example:

<Table> the datasrc attribute of a tag can bind an HTML element to an XML data island. This datasrc attribute references the ID attribute of data island.

<TD> cannot be bound to data island, so we use the <span> label. <Span> allow the dataworks attribute to reference the XML elements to be displayed. In this example, dataworks = "artist" is used to reference the <artist> element in an XML file, while dataworks = "title" is used to reference the <title> element in an XML file. When the XML file is read, more rows are created for each <Cd>.

If the IE browser you are using is version 5.0 or later, you can test it yourself (tiy ).

Source: http://blog.zhongmoo.cn/post/141.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.