XSR object registration

Before an XML schema, DTD, or external entity can be used to process XML documents, it must be registered with the XML schema repository (XSR). Registration with the XSR creates an XSR object.

In order to register most XML schemas, the application heap size configuration parameter (applheapsz) needs to be increased. To register very complex XML schemas on a Windows 32-bit operating system, the agent stack size configuration parameter (agent_stack_sz) may also need to be increased. Please refer to the following related links on how to change either of these configuration parameters.

For XML schemas, XSR object registration involves the following steps:
  1. Register the primary XML schema document in the XML schema repository.
  2. Specify additional XML schema documents to be included with the XSR object. This step is required only if your XML schema consists of more than one schema document.
  3. Complete the registration process with the XML schema repository.

For DTDs and external entities, XSR object registration with the XML schema repository is a single step process.

The XSR object registration steps can be performed from either of the following:
  • Java™ applications
  • Stored procedures
  • Command line processor
Note that you cannot use CLP commands to register XML schemas from host applications, because the required file information cannot be passed through these commands. In order to register XML schemas from applications connecting to a Db2® database through a CLI/ODBC or JDBC driver, use the stored procedure method.

In the description of these methods, the following example of an XML schema made up of two XML schema documents is used: "PO.xsd" and "address.xsd", both stored locally in C:\TEMP. The user wants to register this schema under the SQL two-part name of "user1.POschema". The XML Schema has a properties file associated with it called schemaProp.xml. This properties file is also stored locally, in the same C:\TEMP directory. The two XML schema documents do not have properties associated with them. The user defines the URI by which this schema is externally known as "http://myPOschema/PO".

Privileges

Any user with DBADM authority can register an XSR object. For all other users, the privileges are based on the SQL schema that is supplied during the registration process. If the SQL schema does not exist, then IMPLICIT_SCHEMA authority on the database is required to register the schema. If the SQL schema exists, then the user registering the schema needs CREATEIN privilege on the SQL schema.

For XML schemas, the user to initiate the XSR object registration process (through the XSR_REGISTER stored procedure, for example) must also be the user to specify additional XML schema documents (if applicable) and to complete the registration process.

The USAGE privilege for an XSR object is automatically granted to the creator of the XSR object.