XML database

Database presenting data in XML formats


title: "XML database" type: doc version: 1 created: 2026-02-28 author: "Wikipedia contributors" status: active scope: public tags: ["xml", "data-management", "data-modeling", "xml-databases", "database-management-systems"] description: "Database presenting data in XML formats" topic_path: "technology/databases" source: "https://en.wikipedia.org/wiki/XML_database" license: "CC BY-SA 4.0" wikipedia_page_id: 0 wikipedia_revision_id: 0

::summary Database presenting data in XML formats ::

An XML database is a data persistence software system that allows data to be specified, and stored, in XML format. This data can be queried, transformed, exported and returned to a calling system. XML databases are a flavor of document-oriented databases which are in turn a category of database.

Rationale for XML as a database format

Reasons to store data in XML format as an XML database include:

  • An enterprise may have numerous XML documents with similar data, but dispersed in different XML formats. Conglomerating this data into a singular, standardized XML database structure will avoid compatibility issues
  • 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 parse 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 is often available as XML
  • Semantic web data is available as RDF/XML
  • Provides a solution for Object-relational impedance mismatch
  • Compatibility with XML use on the data transport layer

XML-enabled databases

XML-enabled databases typically offer one or more of the following approaches to storing XML within the traditional relational structure:

  1. XML is stored into a CLOB (Character large object)
  2. XML is shredded into a series of Tables based on a Schema
  3. XML is stored into a native XML Type as defined by ISO Standard 9075-14

RDBMS that support the ISO XML Type are:

  1. IBM DB2 (pureXML)
  2. Microsoft SQL Server
  3. Oracle Database
  4. 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

::code[lang=sql] select id, vol, xmlquery('$j/name', passing journal as "j") as name from journals where xmlexists('$j[licence="CreativeCommons"]', passing journal as "j") ::

Integration with relational databases

XML databases are often used in combination with relational databases to manage and store hierarchical data. A significant challenge in such integrations is extracting XML documents from relational databases, which requires specialized techniques and tools. These techniques often include:

  1. Mapping Relational Data to XML: Schema mapping is a critical process that defines how relational tables correspond to XML elements and attributes.
  2. XQuery Processing: Querying XML data extracted from relational databases may involve XQuery, a language designed for querying and transforming XML.

One of the most common scenario involves converting relational data into XML documents to facilitate standards with systems relying on XML-based standards, such as web services or APIs. This process is important in applications where structured and semi-structured data co-exist and must be integrated perfectly.

For example, extracting hierarchical data from relational databases and converting it into XML is a common approach when generating XML feeds, exchanging data between systems, or implementing XML-based configurations.

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 has fields and rows.

The standard for querying XML data per W3C recommendation is XQuery; the latest version is XQuery 3.1. XQuery includes XPath as a sub-language and XML itself is a valid sub-syntax of XQuery. In addition to XPath, some XML databases support XSLT as a method of transforming documents or query results retrieved from the database.

Language features

::data[format=table]

NameLicenseNative LanguageXQuery 3.1XQuery 3.0XQuery 1.0XQuery UpdateXQuery Full TextEXPath ExtensionsEXQuery ExtensionsXSLT 2.0XForms 1.1XProc 1.0
BaseXJava
eXistJava
MarkLogic ServerC++
OpenText xDBJava
Oracle Berkeley DB XMLC/C++
QizxJava
SednaApache License 2.0C/C++
::

Supported APIs

::data[format=table]

NameXQJXML:DBRESTfulRESTXQWebDAV
BaseX
eXist
MarkLogic Server
Qizx
Sedna
::

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

References

  1. (28 September 2010). "5 Reasons for Storing XML in a Database".
  2. (11 April 2013). "Moving from Relational Modeling to XML and MarkLogic Data Models".
  3. [NoSQL Distilled: A Brief Guide to the Emerging World of Polyglot Persistence. Addison-Wesley Educational Publishers Inc, 2009] {{ISBN. 978-0321826626
  4. (August 2005). "Oracle XML DB Developer's Guide, 10''g'' Release 2". Oracle Corporation.
  5. (2011). "ISO/IEC 9075-14:2011: Information technology -- Database languages -- SQL -- Part 14: XML-Related Specifications (SQL/XML)". [[International Organization for Standardization]].
  6. "pureXML overview -- DB2 as an XML database". [[IBM]].
  7. "Using XML in SQL Server". [[Microsoft Corporation]].
  8. (August 2005). "Oracle XML DB Developer's Guide, 10''g'' Release 2". Oracle Corporation.
  9. "PostgreSQL 9.6 Documentation".
  10. (2025-01-01). "Extracting XML Documents from Relational Databases - 7 Tips".
  11. (22 August 2010). "XML versus Relational Database Performance".
  12. (2017-03-21). "XQuery 3.1 Recommendation".
  13. (2014). "XDMA: A Dual Indexing and Mutual Summation Based Keyword Search Algorithm for XML Databases". International Journal of Software Engineering and Knowledge Engineering.

::callout[type=info title="Wikipedia Source"] This article was imported from Wikipedia and is available under the Creative Commons Attribution-ShareAlike 4.0 License. Content has been adapted to SurfDoc format. Original contributors can be found on the article history page. ::

xmldata-managementdata-modelingxml-databasesdatabase-management-systems