An XML database is a data persistence software system that allows data to be specified, and sometimes 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 NoSQL database.
XML Database is used to store huge amount of information in the XML format. As the use of XML is increasing in every field, it is required to have a secured place to store the XML documents. The data stored in the database can be queried using XQuery, serialized, and exported into a desired format.
XML Database Types
There are two major types of XML databases:
- XML- enabled
- Native XML (NXD)
XML-Enabled Database
XML enabled database is nothing but the extension provided for the conversion of XML document. This is a relational database, where data is stored in tables consisting of rows and columns. The tables contain set of records, which in turn consist of fields.
Native XML Database
Native XML database is based on the container rather than table format. It can store large amount of XML document and data. Native XML database is queried by the XPath-expressions.
Native XML database has an advantage over the XML-enabled database. It is highly capable to store, query and maintain the XML document than XML-enabled 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. 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 is often available as XML.
- Semantic web data is available as RDF/XML.
- Provides a solution for Object-relational impedance mismatch.
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).
- XML is `shredded` into a series of Tables based on a Schema.
- XML is stored into a native XML Type as defined by ISO Standard 9075-14.