DB2 Version 9.7 for Linux, UNIX, and Windows

Annotated XML schema decomposition

Annotated XML schema decomposition (or "shredding") is the process of storing content from an XML document in columns of relational tables. Decomposition operates based on annotations specified in an XML schema. After an XML document is decomposed, the inserted data has the SQL data type of the column that it is inserted into.

An XML schema consists of one or more XML schema documents. In annotated XML schema decomposition, or schema-based decomposition, you control decomposition by annotating a document's XML schema with decomposition annotations. These annotations specify details such as the name of the target table and column the XML data is to be stored in, the default SQL schema for when a target table's SQL schema is not identified, the order in which XML data should be inserted into target tables, as well as any transformation of the content before it is stored. Refer to the summary of decomposition annotations for further examples of what can be specified through these annotations.

The annotated schema documents must be stored in and registered with the XML schema repository (XSR). The schema must then be enabled for decomposition.

After the successful registration of the annotated schema, decomposition of a single XML document can be performed either by calling one of the decomposition stored procedures or by executing the DECOMPOSE XML DOCUMENT command. To decompose multiple XML documents stored in a column, use XDB_DECOMP_XML_FROM_QUERY stored procedure or the DECOMPOSE XML DOCUMENTS command

Note that schema-based decomposition can be disabled or made inoperative. Refer to the topic on decomposition disablement for more information.