Beginning XML Databases (Wrox Beginning Guides)

Chapter 9 gave a generic introduction to what exactly a native XML database is. Essentially, a native XML database is an XML document. Every XML document is a form of a database, all by itself. Why? Because every XML document contains both metadata and data. The data lies in the textual values between the opening and closing tags, and in the values of attributes in elements. In the following example, Algeria is data, and 1 is also data because it is the value of the id attribute:

<country id="1">Algeria</country>

Metadata in an XML document is dictated by the elements, the attributes describing those elements (relating attributes to parent elements), and the relationships between all the elements in the entire XML document (the hierarchy). In the following example, a hierarchy can be clearly seen between the various types of locations. Also, attributes describe aspects of each location:

<?xml version="1.0"?> <demographics> < region id ="1" name="Africa"> <population>"Lots and lots"</population> <area>"More than most would think"</area> < country id="1" name="Egypt"> <population>"20 million"</population> <area>"A big country"</area> < city id="1" name="Cairo"> < population >"Could be 12 million"</population> <area>"Kinda big"</area> </city> <city id="2" name="Alexandria"> <population>"Lets say 5 million"</population> <area>"Not as big as Cairo"</area> </city> </country> <country id="2" name="South Africa"/> </region> <region id="2" name="Europe"> <population>"Probably close to 1 billion"</population> <area>"Less than you might think"</area> </region> <region id="3" name="North America"/> </demographics>

There are numerous well-known, widely used, and also well-supported native XML databases:

Many native XML databases support tools such as XPath 2.0, XQuery, XLink, and XPointer as do some relational databases, to a lesser and greater degree. If not, then relational database vendors are likely working on these issues, if they are in demand.

Категории