Databases Reference
In-Depth Information
The key difference between
HTML
and
XML
is that the semantics (or meaning) of
each
HTML
element has been predefined by
W3C
standards. In the sales order exam-
ple, the meaning of each sales order element is determined by the individual organi-
zation. Even though there may be an
XML
standard for sales orders, each organization
can decide to create data element names specific to their organization and store those
element names, and their definition, in a data dictionary.
Anyone who's familiar with
XML
recognizes it as a mature standard with an ecosys-
tem of tools to support it. There are tools to extract subtrees from
XML
documents
(
XPath
), tools to query
XML
documents (
XQuery
), tools to validate
XML
documents
(
XML
Schema and Schematron), and tools to transform
XML
documents from one
format to another.
RDBMS
vendors like Oracle, Microsoft, and
IBM
have included
XML
management
features in their products. Their approach is to add an
XML
column type to the
RDBMS
. Once added,
XML
documents are stored in the column in the same way a
binary large object (
BLOB
)
is stored. Though this strategy meets the needs of many use
cases, it lacks portability since object-relational mapping tools don't generate the cor-
rect
SQL
to select
XML
elements within
BLOB
s.
The main disadvantage of
XML
, and a limitation of native
XML
systems, is that
XML
is a standard that attempts to solve many different types of problems with a single for-
mat. Without adequate tools and training, development staff may become frustrated
with
XML
's complexity and continue to use simpler formats such as
JSON
or
CSV
. With-
out good
GUI
tools, developers are forced to view raw
XML
files that can be more ver-
bose than the corresponding
JSON
representation.
Despite this issue, many developers find that native
XML
databases offer a simpler
way of solving problems. Their rich query language and
XML
standards help to lower
overall costs. It should also be noted that native
XML
databases don't store literal
XML
.
They store a compact version in a compressed format.
XML
files are only used to put
data into and retrieve data from the database.
Now that you have an understanding of what native
XML
databases are and the
kinds of problems they solve, let's explore how native
XML
databases are used to build
applications that can add, transform, search, and update
XML
documents.
5.2
Building applications with a native XML database
Native
XML
databases and their associated tools are key to increasing developer pro-
ductivity. Using simple query languages allows programmers and nonprogrammers to
simply create and customize reports. The combination of standards, mature query
languages, robust tools, and document orientation makes the application develop-
ment process faster. You'll find it difficult to convince native
XML
users to move to
another platform once they've created applications with these systems.
Getting started with a native
XML
database can be simpler than you think. If you
understand the concept of dragging files and folders, you're well on your way to creat-
ing your first native
XML
database. As you browse through the next section, you'll see
how simple it can be to get started.