HTML and CSS Reference
In-Depth Information
12 Creating and Using XML
Documents
Introduction
Internet Explorer and
Data Islands
Data Island were first used
in Internet Explorer 5.
The <xml> tag, used to
link the XML file with
the HTML page is unique
to Internet Explorer and
is still used in Internet
Explorer 9. To use data
islands in other browsers
requires embedding the
entire XML data contents
into the HTML file, and
creating what is called a
"data block."
In this chapter, you will learn how to create XML data files for use as stand-alone Web
pages, format files using an XSL style sheet, and bind XML files to HTML5 Web pages.
In some cases, the XML data will display in HTML5 tables, and in other cases, the XML
data will display in other formats. In particular, you create and use an XML document as
a database or data island. A data island is a set of data elements separate from the main
HTML5 Web page. The advantage to using an XML data island is the reduction of
database management system activity needed just to display data.
By binding or linking the XML data to an HTML5 Web page using the <xml>
tag, the HTML5 objects can be manipulated to enhance usability. The <xml> tag, which
is particular only to Microsoft Internet Explorer, was first introduced with Internet
Explorer 5. The techniques presented in this chapter work only with Microsoft Internet
Explorer 8 and 9. In particular, the HMTL5 code is used to display the data island in a
table and to search for specific items using a JavaScript user-defined function.
Project — Creating an XML Document
XML as a Data Island
A data island has the
capability of embedding
XML documents in HTML
pages. The process uses
data source object (dso)
technology. The disad-
vantage to using an XML
data island is that the
XML documents are static.
Client-side processing
does not allow real-time
updates to the XML
document on the server.
Calumet Restaurant Supply's Web site with its product list has been a great success.
Customers, however, have been asking for other ways to browse or search the product list.
You have recently learned about Extensible Markup Language (XML), which offers some
flexibility not found with traditional HTML5 pages. You suggest the Web site offer clients
various ways to view the product lists, including using the Extensible Stylesheet Language
(XSL) to transform an XML document into a readable format displayed by item-id number.
Next, you suggest using an HTML5 table in which the user can browse the products in
order by description. Finally, you suggest using JavaScript to allow a user to search for
products by an item description.
The Web pages shown in Figure 12-1 demonstrate three different applications
of the same XML document. Figure 12-1a shows Calumet Restaurant Supply's home
page containing three links: one link opens an XML page in a browser displaying a
list of all the available products formatted by an XSL style sheet in item-description
order (Figure 12-1b). The next link displays the XML data in a table in item-id order
(Figure 12-1c). The last link displays a Web page to search for products by any part of the
item description (Figure 12-1d).
HTML5 562
Search WWH ::




Custom Search