Databases Reference
In-Depth Information
In between the <dataroot> and </dataroot> statements in Figure 9-9, there are three groups of statements, one
group for each record from the Rep table. Each statement group starts with a <Rep> tag and ends with a match-
ing closing </Rep> tag; those tags identify the beginning and end of one Rep record. User-defined tag pairs (such as
<Rate> and </Rate>) enclose field values, which are called element values (such as 0.05, 0.07, and 0.05) from the
Rep records. Each tag must have a matching closing tag in an XML document.
Web pages continue to be written in HTML, but the last W3C recommendation was for HTML 4.01 in 1999.
Since then, the W3C has focused on recommendations for Extensible Hypertext Markup Language (XHTML) ,
which is a markup language based on XML and, thus, is a stricter version of HTML. Web browsers con-
tinue to support HTML and have been slow to adapt to the XHTML specification. However, as more organiza-
tions use XML, more XHTML-based Web pages will be created and used on the Internet.
An XML document contains element tags and element values. How does an XML processor understand the
meaning of the tags and the characteristics and structure of the data in an XML document? You use either a
Document Type Definition or an XML schema to provide those important facts about the data. A Document
Type Definition (DTD) specifies the elements (tags), the attributes (characteristics associated with each tag),
and the element relationships for an XML document. The DTD can be a separate file with a .dtd extension,
or you can include it at the beginning of an XML document. An XML schema is a newer form of DTD that more
closely matches database features and terminology; you can embed it at the beginning of an XML document
or place it in a separate file with an .xsd extension. Figure 9-10 shows the portion of an XML schema specify-
ing the characteristics of the Rate field from the Rep table. Notice how closely the attributes for the Rate ele-
ment in the XML schema match the properties for the Rate field in the Rep table.
292
<xsd:element name="Rate" minOccurs="0" jetType="double"
sqlSType="float" type="xsd:double">
<xsd:annotation>
<xsd:appinfo>
<fieldProperty name="ColumnWidth" type="3" value="840"/>
<fieldProperty name="ColumnOrder" type="3" value="0"/>
<fieldProperty name="ColumnHidden" type="1" value="0"/>
<fieldProperty name="DecimalPlaces" type="2" value="255"/>
<fieldProperty name="Required" type="1" value="0"/>
<fieldProperty name="DisplayControl" type="3" value="109"/>
<fieldProperty name="TextAlign" type="2" value="0"/>
<fieldProperty name="AggregateType" type="4" value="-1"/>
<fieldProperty name="GUID" type="9"
value="CgLbv43o5ECFLODxDEetHA=="/>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
FIGURE 9-10
XML schema for the Rate element from the Rep table
XML documents contain data; and DTDs and XML schemas define the structure, characteristics, and rela-
tionships of the data in an XML document. Also, XHTML documents focus on data, not on presentation details.
The presentation aspects of an XML or XHTML document can be described by a stylesheet. The Extensible
Stylesheet Language (XSL) is a standard W3C language for creating stylesheets for XML documents; a
stylesheet is a document that specifies how to process the data contained in another document and present
the data in a Web browser, in a printed report, on a mobile device, in a sound device, or in other presenta-
tion media. A related W3C standard language is XSL Transformations (XSLT) , which defines the rules to
process an XML document and change it into another document; this other document may be another XML
document, an XSL document, an HTML or XHTML document, or most any other type of document.
 
Search WWH ::




Custom Search