Re: New XML section for documentation

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: nikolay(at)samokhvalov(dot)com
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: New XML section for documentation
Date: 2006-08-26 16:50:59
Message-ID: 200608261650.k7QGoxp05283@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs pgsql-hackers


Updated XML documentation based on feedback. Comments?

---------------------------------------------------------------------------

XML Document Support
====================
XML (eXtensible Markup Language) support is not one capability, but a
variety of features supported by a database system. These capabilities
include storage, import/export, validation, indexing, efficiency of
modification, searching, transformating, and XML to SQL mapping.
PostgreSQL supports some but not all of these XML capabilities. Future
releases of PostgreSQL will continue to improve XML support.

Storage
-------

PostgreSQL does not have a specialized XML data type. Users should
store XML documents in ordinary TEXT fields. If you need the document
split apart into its component parts so each element is stored
separately, you must use a middle-ware solution to do that, but once
done, the data becomes relational and has to be processed accordingly.

Import/Export
-------------
There is no facility for mapping XML to relational tables. An external
tool must be used for this. One simple way to export XML is to use psql
in HTML mode ("\pset format html"), and convert the XHTML to XML using
an external tool.

Validation
----------
/contrib/xml2 has a function called xml_valid() that can be used in
a CHECK constraint to enforce that a field contains valid XML. It
does not support validation against a specific XML schema. A
server-side language with XML capabilities could be used to do
schema-specific XML checks.

Indexing
--------
/contrib/xml2 functions can be used in expression indexes to index
specific XML fields. To index the full contents of XML documents, the
full-text indexing tool /contrib/tsearch2 can be used. Of course,
tsearch2 indexes have no XML awareness so additional /contrib/xml2
checks should be added to queries.

Modification
------------
If an UPDATE does not modify an XML field, the XML data is shared
between the old and new rows. However, if the UPDATE modifies a XML
field, a full modified copy of the XML field must be created internally.

Searching
---------
XPath searches are implemented using /contrib/xml2. It processes XML
text documents and returns results based on the requested query.

Transforming
------------
/contrib/xml2 supports XSLT (XML Stylesheet Language Transformation).

XML to SQL Mapping
-------------------
This involves converting XML data to and from relational structures.
PostgreSQL has no internal support for such mapping, and relies on
external tools to do such conversions.

Missing Features
----------------
o XQuery
o SQL/XML syntax (ISO/IEC 9075-14)
o XML data type optimized for XML storage

See also http://www.rpbourret.com/xml/XMLAndDatabases.htm for an
overview XML use in databases, and http://wiscorp.com/SQLStandards.html
for the XML standards.

--
Bruce Momjian bruce(at)momjian(dot)us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message David Fetter 2006-08-26 17:14:33 Re: [HACKERS] New XML section for documentation
Previous Message Bruce Momjian 2006-08-26 16:48:32 Re: [HACKERS] New XML section for documentation

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2006-08-26 16:54:39 Re: Coding style for emacs
Previous Message Bruce Momjian 2006-08-26 16:48:32 Re: [HACKERS] New XML section for documentation