P1: IML/FFX P2: IML/FFX QC: IML/FFX T1: IML
WL040A-09 WL040/Bidgoli-Vol III-Ch-69 August 14, 2003 18:12 Char Count= 0
XML: A NEWPARADIGM FORINTERNETDOCUMENTS 867Figure 4: XML example.Therefore, recipients of this document can decode the
XML data and use it for their own purposes. For instance,
a customer manager might use it to find customers who
live in the Waterloo area (<CITY>Waterloo</CITY>).
Because HTML tags are predefined and understood
by Web browsers, the Web browsers can display HTML-
tagged documents. In contrast, because XML enables
users to create any tags they need, the meaning of these
tags will not necessarily be understood by a Web browser
unless they are the preexisting HTML commands. There
is no way for a generic Web browser to anticipate all
possible tags and contain all the necessary rules for dis-
playing them. Thus, to display XML documents in a Web
browser, it is necessary to have a mechanism to describe
how the document should be displayed. This is done by
means of a style sheet. A style sheet is prepared using style
sheet language. Two of the most popular style sheet
languages are CSS (Cascading Style Sheets) and XSLT
(Extensible Stylesheet Language Transformations). CSS
provides procedural control by putting the additional
presentation control information needed to force a
browser to override its internal style sheet inside the
HTML file. Thus, the following command overrides the
browser’s internal style sheet to turn text between <H1>
and </H1> blue while forcing it to a 12-point font size
regardless of user settings.<STYLE TYPE=text/css>
H1 {color:blue font-size:12.000000pt}
</STYLE>When a browser reads a style sheet, it will format the
document accordingly. There are three ways of linking a
style sheet to HTML: external style sheet, internal style
sheet, and inline styles. An external style sheet can be cre-
ated with any text editor, and a CSS style sheet shouldbe saved with a “css” extension. Figure 5 shows an ex-
ample of an external style sheet. An internal style sheet
should be used when a document has a unique style.
The internal style sheet is defined in the head section
by using the <style> tag. The example shows an inter-
nal style sheet. Finally, inline styles can be used with
the style attribute in the relevant tag. The style attribute
can contain any CSS property. (Further information may
be found at http://www.htmlhelp.com/reference/css/style-
html.html, Web Design Group, n.d.)
Figure 5 contains the CSS code used to represent the
XML example in Figure 4, so that it can be displayed by
a Web browser exactly like Figure 3. There are several
tools available to create the CSS code (e.g., Microsoft
FrontPage).
After a XML document and a style sheet for that doc-
ument are prepared, the XML document can be shown
in the Web browser by including an instruction in the
XML document specifying the style sheet to be used,
as in Figure 4:<?xml-stylesheet type = “text/css” href =
“customer.css”?>. Of course, an HTML document is but
one way of presenting an XML document. Because XML
separates content from presentation format, through the
use of style sheets and other programmatic methods, the
content in XML can be presented in several ways, such as
an HTML document, text document, and spreadsheet.Benefits of XML
XML enhances the power and flexibility of Web-based
applications and other business software packages.
It is an open standard and is system and platform
independent. Also, it is free—the XML specifications of
tags and attributes are developed by the W3C, which
is a consortium led by not-for-profit entities. Thus,
XML creates a universal way for both formatting and
presenting data and enables putting structured data