An XML database is a
data persistence
In computing, a persistent data structure or not ephemeral data structure is a data structure that always preserves the previous version of itself when it is modified. Such data structures are effectively immutable, as their operations do not (v ...
software system that allows data to be specified, and sometimes stored, in
XML
Extensible Markup Language (XML) is a markup language and file format for storing, transmitting, and reconstructing arbitrary data. It defines a set of rules for encoding documents in a format that is both human-readable and machine-readable ...
format. This data can be
queried, transformed, exported and returned to a calling system. XML databases are a flavor of
document-oriented database
A document-oriented database, or document store, is a computer program and data storage system designed for storing, retrieving and managing document-oriented information, also known as semi-structured data.
Document-oriented databases are one ...
s which are in turn a category of
NoSQL
A NoSQL (originally referring to "non- SQL" or "non-relational") database provides a mechanism for storage and retrieval of data that is modeled in means other than the tabular relations used in relational databases. Such databases have existed ...
database.
Rationale for XML in databases
There are a number of reasons to directly specify data in XML or other document formats such as
JSON
JSON (JavaScript Object Notation, pronounced ; also ) is an open standard file format and data interchange format that uses human-readable text to store and transmit data objects consisting of attribute–value pairs and arrays (or other ser ...
. For XML in particular, they include:
* An enterprise may have a lot of XML in an existing standard format
* Data may need to be exposed or ingested as XML, so using another format such as relational forces double-modeling of the data
* XML is very well suited to sparse data, deeply nested data and mixed content (such as text with embedded markup tags)
* XML is human readable whereas relational tables require expertise to access
*
Metadata
Metadata is "data that provides information about other data", but not the content of the data, such as the text of a message or the image itself. There are many distinct types of metadata, including:
* Descriptive metadata – the descriptive ...
is often available as XML
* Semantic web data is available as
RDF/XML
* Provides a solution for
Object-relational impedance mismatch
Steve O'Connell gives one reason for the use of XML in databases: the increasingly common use of XML for
data transport, which has meant that "data is extracted from databases and put into XML documents and vice-versa".
It may prove more efficient (in terms of conversion costs) and easier to store the data in XML format. In content-based applications, the ability of the native XML database also minimizes the need for extraction or entry of metadata to support searching and navigation.
XML-enabled databases
XML-enabled databases typically offer one or more of the following approaches to storing XML within the traditional relational structure:
#XML is stored into a CLOB (
Character large object
A Character Large OBject (or CLOB) is part of the SQL:1999 standard data types. It is a collection of character data in a database management system, usually stored in a separate location that is referenced in the table itself. Oracle and IBM ...
)
#XML is `shredded` into a series of Tables based on a Schema
[. Sectio]
Creating XMLType Tables and Columns Based on XML Schema
/ref>
#XML is stored into a native XML Type as defined by ISO Standard 9075-14
RDBMS that support the ISO XML Type are:
#IBM DB2 (pureXML)
#Microsoft SQL Server
#Oracle Database
#PostgreSQL
Typically an XML-enabled database is best suited where the majority of data are non-XML. For datasets where the majority of data are XML, a native XML database is better suited.
Example of XML Type Query in IBM DB2 SQL
select
id, vol, xmlquery('$j/name', passing journal as "j") as name
from
journals
where
xmlexists('$j icence="CreativeCommons", passing journal as "j")
Native XML databases
Native XML databases are especially tailored for working with XML data. As managing XML as large strings would be inefficient, and due to the hierarchical nature of XML, custom optimized data structures are used for storage and querying. This usually increases performance both in terms of read-only queries and updates. XML nodes and documents are the fundamental unit of (logical) storage, just as a relational database
A relational database is a (most commonly digital) database based on the relational model of data, as proposed by E. F. Codd in 1970. A system used to maintain relational databases is a relational database management system (RDBMS). Many relatio ...
has fields and rows.
The standard for querying XML data per W3C recommendation is XQuery
XQuery (XML Query) is a query and functional programming language that queries and transforms collections of structured and unstructured data, usually in the form of XML, text and with vendor-specific extensions for other data formats (JSON, bin ...
; the latest version is XQuery 3.1. XQuery includes XPath
XPath (XML Path Language) is an expression language designed to support the query or transformation of XML documents. It was defined by the World Wide Web Consortium (W3C) and can be used to compute values (e.g., strings, numbers, or Boolean v ...
as a sub-language and XML itself is a valid sub-syntax of XQuery. In addition to XPath, some XML databases support XSLT
XSLT (Extensible Stylesheet Language Transformations) is a language originally designed for transforming XML documents into other XML documents, or other formats such as HTML for web pages, plain text or XSL Formatting Objects, which may subseque ...
as a method of transforming documents or query results retrieved from the database.
Language features
Supported APIs
Data-centric XML datasets
For data-centric XML datasets, the unique and distinct keyword search method, namely, XDMA for XML databases is designed and developed based on dual indexing and mutual summation.
References
External links
Ranking of Native XML DBMS
by popularity, updated monthly, from DB-Engines
XML Databases - The Business Case, Charles Foster, June 2008
- Talks about the current state of Databases and data persistence, how the current Relational Database model is starting to crack at the seams and gives an insight into a strong alternative for today's requirements.
An XML-based Database of Molecular Pathways (2005-06-02)
Speed / Performance comparisons of eXist, X-Hive, Sedna and Qizx/open
XML Native Database Systems: Review of Sedna, Ozone, NeoCoreXMS
2006
XML Data Stores: Emerging Practices
* Bhargava, P.; Rajamani, H.; Thaker, S.; Agarwal, A. (2005) ''XML Enabled Relational Databases'', Texas, The University of Texas at Austin.
Initiative for XML Databases
The State of Native XML Databases, Elliotte Rusty Harold, August 13, 2007
{{Databases
XML
Data management
Data modeling