DB2 Version 10.1 for Linux, UNIX, and Windows

XML data specifier

XML data moved with the export, import and load utilities must be stored in files separate from the main data file. The XML data is represented in the main data file with an XML data specifier (XDS).

The XDS is a string represented as an XML tag named "XDS", which has attributes that describe information about the actual XML data in the column; such information includes the name of the file that contains the actual XML data, and the offset and length of the XML data within that file. The attributes of the XDS are described in the following list.

FIL
The name of the file that contains the XML data. You cannot specify a named pipe. Importing or loading XML documents from a named pipe is not supported.
OFF
The byte offset of the XML data in the file named by the FIL attribute, where the offset begins from 0.
LEN
The length in bytes of the XML data in the file named by the FIL attribute.
SCH
The fully qualified SQL identifier of the XML schema that is used to validate this XML document. The schema and name components of the SQL identifier are stored as the "OBJECTSCHEMA" and "OBJECTNAME" values, respectively, of the row in the SYSCAT.XSROBJECTS catalog table that corresponds to this XML schema.

The XDS is interpreted as a character field in the data file and is subject to the parsing behavior for character columns of the file format. For the delimited ASCII file format (DEL), for example, if the character delimiter is present in the XDS, it must be doubled. The special characters <, >, &, ', " within the attribute values must always be escaped. Case-sensitive object names must be placed between &quot; character entities.

Examples

Consider a FIL attribute with the value abc&"def".del. To include this XDS in a delimited ASCII file, where the character delimiter is the " character, the " characters are doubled and special characters are escaped.

<XDS FIL=""abc&amp;&quot;def&quot;.del"" />

The following example shows an XDS as it would appear in a delimited ASCII data file. XML data is stored in the file xmldocs.xml.001 beginning at byte offset 100 with a length of 300 bytes. Because this XDS is within an ASCII file delimited with double quotation marks, the double quotation marks within the XDS tag itself must be doubled.

"<XDS FIL = ""xmldocs.xml.001"" OFF=""100"" LEN=""300"" />"

The following example shows the fully qualified SQL identifier ANTHONY.purchaseOrderTest. The case-sensitive portion of the identifier must be placed between &quot; character entities in the XDS:

"<XDS FIL='/home/db2inst1/xmlload/a.xml' OFF='0' LEN='6758' 
   SCH='ANTHONY.&quot;purchaseOrderTest&quot;' />"