Datasheet

Attributes are not expansion friendly. It is more difficult to change metadata than it is to
change data. It should be. If you have to change metadata then there might be data structural
design issues anyway. In a purely database environment (not using XML), changing the
database model is the equivalent of changing metadata. In commercial environments metadata
is usually not altered because it is too difficult and too expensive. All application code depends
on database structure not being changed. Changing database metadata requires application
changes as well. That’s why it can get expensive. From a perspective of XML and XML in
databases, you do not want to change attributes because attributes represent metadata, and
that is a database modeling design issue not a programming issue. Changing the data is
much, much easier.
Try It Out Using XML Syntax
The following data represents three regions, containing six countries, as in the previous Try It Out sec-
tions in this chapter. In this example, currencies are now added:
Africa Zambia Kwacha
Africa Zimbabwe Zimbabwe Dollars
Asia Burma
Australasia Australia Dollars
Caribbean Bahamas Dollars
Caribbean Barbados Dollars
In this example, you use what you have learned about the difference between XML document elements
and attributes.
The following script is the XML document created in the first Try It Out section in this chapter:
<?xml version=”1.0”?>
<regions>
<region>Africa</region>
<country>Zambia</country>
<country>Zimbabwe</country>
<region>Asia</region>
<country>Burma</country>
<region>Australasia</region>
<country>Australia</country>
<region>Caribbean</region>
<country>Bahamas</country>
<country>Barbados</country>
</regions>
You will use the preceding XML document and add the currencies for each country. Do not create any
new elements in this XML document.
Change the XML document as follows:
1. Open the XML document. You can copy the existing XML text into a new text file if you want.
22
Chapter 1
04_791202 ch01.qxp 10/6/06 10:59 AM Page 22