Database Reference
In-Depth Information
75$16 !
75$16 !
7UDQVDFWLRQ,' ! 7UDQVDFWLRQ,' !
6DOHV3ULFH ! 6DOHV3ULFH !
:25. !
:RUN,' ! :RUN,' !
7LWOH ! /D/HFRQGH6NL 7LWOH !
&RS\ ! &RS\ !
$57,67 !
$UWLVW,' ! $UWLVW,' !
$UWLVW1DPH ! 0LUR $UWLVW1DPH !
$57,67 !
:25. !
75$16 !
&86720(5 !
(c) FOr XML aUtO, ELEMENtS Partial results in XML Document
Figure 11-59
Continued
A Schema with Two Multivalued Paths
Suppose now that we want to construct an XML document that has all of the View Ridge
Gallery customer data. We cannot construct such a view from a single SQL statement because
it has two multivalued paths. We need one SQL statement to obtain all of the customer pur-
chase data and a second SQL statement to obtain all of the customer/artist interests.
XML Schema does not have this limitation, however. An XML document may have as
many multivalued paths as the application requires. In our case, all we need to do is to com-
bine the schemas in Figure 11-58(a) and Figure 11-60(a). While we are at it, we can also add the
surrogate keys for each of the underlying tables.
The result of combining these results (using cut and paste in XMLSpy!) is shown in
Figure 11-61. Observe that, in Figure 11-61(b), MyData may have from one to an unlimited
number of CUSTOMER elements and that each such element may have from zero to many
TRANS and from zero to many ArtistInterests elements. All of the simple elements in this
schema are required.
Why Is XML Important?
At this point, you should have some idea of the nature of XML and the XML standards. You know
that XML makes a clear separation between structure, content, and materialization. Structure is
defined by either a DTD or an XML Schema document. Content is expressed in an XML docu-
ment, and the materializations of a document are expressed in an XSL document. You also un-
derstand that SQL statements can be used to create XML documents, but only as long as those
documents involve at most one multivalued path. If more than one such path exists in the docu-
ment, multiple SQL statements need to be issued to fill the document in some fashion.
You may be asking, “These are interesting ideas, but why do they matter? What's so im-
portant about all of this?” The answer to these questions is that XML processing provides a
standardized facility to describe, validate, and materialize any database view.
Consider the View Ridge Gallery. Suppose that the gallery wants to share all of its customer
data with another gallery, maybe because of a joint sales program. If both galleries agree on an
XML Schema like the one shown in Figure 11-61, they can prepare customer data documents in
accordance with that schema. Before sending a document, they can run an automated process
to validate the document against the schema. In this way, only correct data are transmitted. Of
course, this process works in both directions. Not only can View Ridge ensure that it is sending
only valid documents; by validating the documents it receives, it can ensure that it is receiving
only valid documents. Best of all, the programs for document validation are publicly available
and free to the galleries. The galleries do not need to write program code for validation.
Additionally, each gallery can develop its own set of XSL documents to materialize
the customer data documents in whatever ways it wants. View Ridge can develop one XSL
 
 
Search WWH ::




Custom Search