Database Reference
In-Depth Information
Further, each company can develop its own set of XSL documents to materialize property list-
ings in whatever way it wants. Once the XSL documents have been prepared, any listing from
any participating agent can be displayed in the local agency's materializations. Figure 11-62
lists some XML standards work that is under way in various industries.
For another example, consider business-to-business e-commerce. Suppose that Wal-Mart
wants to send orders to its vendors in a particular standardized format and that it wants to
receive shipment responses to those orders in another particular standardized format. To do
this, Wal-Mart can develop an XML Schema for Order documents and another for Shipment
documents. It can then publish those XML Schemas on a Web site accessible to its vendors. In
this way, all vendors can determine how they will receive orders from Wal-Mart and how they
should send their Shipment notifications back.
The schemas can be used by Wal-Mart and all of its vendors to ensure that they are send-
ing and receiving only valid XML documents. Further, Wal-Mart can develop XSL documents
to cause the Order and Shipment documents to be transformed into the specific formats
needed by its accounting, operations, marketing, and general management departments.
These XSL documents work for any Order or Shipment from any of its vendors. In all of
these cases, once the XML Schema documents have been prepared and the XSL documents
have been written, all validation and materialization are done via automated processes.
Thus, there is no need for any human to touch the Order document between its origination
at Wal-Mart and the picking of the inventory at the supplier.
So, the only challenge that remains is to populate the XML documents with database data
in accordance with the relevant XML Schema. SQL can be used to populate schemas that have
only one multivalued path, but this is too restrictive, and newer technologies like ADO.NET
ease the transformation of database data into XML documents. SQL can also be used to ease
the transformation of XML documents into database data.
Additional XML Standards
As you know, XML was developed as a series of standards. So far, we have mentioned XML,
XSL, XSLT, and XML Schema. You will probably encounter a number of other XML standards,
and some of these are listed in Figure 11-63. You can find the standards, their documentation,
and some tutorials on the www.w3.org and www.xml.org Web sites.
In addition to the four standards discussed in this chapter, XPath is a standard for
addressing elements within documents. In Figure 11-49, note the expressions like:
<xsl: value-of-select = "Name/LastName"/>
These expressions use XPath to locate a particular element in the document. XPath includes
concepts from another standard, XPointer, which was developed to provide a sophisticated
means for documents to reference elements in other documents.
SAX and DOM refer to different methods of parsing XML documents. The process of pars-
ing consists of reading a document, breaking it into components, and responding to those
components in some way—perhaps storing them into a database. XML parsers also validate
documents against the DTDs and XML Schemas.
To use the SAX API, a program that is working on an XML document—an XSLT processor, for
example—invokes the SAX-compliant parser and passes it the name of the document to parse. The
SAX parser processes the document and calls back objects within the XSLT processor whenever
particular structures are encountered. A SAX parser, for example, calls the XSLT parser when it
encounters a new element, passing the name of the element, its content, and other relevant items.
The DOM API works from a different paradigm. A DOM-compliant parser processes
the entire XML document and then creates a tree representation of it. Each element of the
document is a node on the tree. The XSLT processor can then call the DOM parser to obtain
particular elements using XPath or a similar addressing scheme. DOM requires the entire
document to be processed at one time and may require an unreasonable amount of storage
for very large documents. If the document is large, SAX is the better choice. However, if all of
the document contents need to be available for use at once, DOM is the only choice.
 
 
Search WWH ::




Custom Search