DB2 Version 9.7 for Linux, UNIX, and Windows

REGISTER XSROBJECT command

Registers an XML object in the database catalogs. Supported objects are DTDs and external entities.

Authorization

One of the following:
  • dbadm
  • IMPLICIT_SCHEMA database authority if the SQL schema does not exist
  • CREATEIN privilege if the SQL schema exists

Required connection

Database

Command syntax

Read syntax diagramSkip visual syntax diagram
>>-REGISTER XSROBJECT--system-ID--+-------------------+--------->
                                  '-PUBLIC--public-ID-'   

>--FROM--content-URI--+---------------------------+------------->
                      '-AS--relational-identifier-'   

>--+-DTD-------------+-----------------------------------------><
   '-EXTERNAL ENTITY-'   

Command parameters

system-ID
Specifies the system ID that is specified in the XML object declaration.
PUBLIC public-ID
Specifies an optional PUBLIC ID in the XML object declaration.
FROM content-URI
Specifies the URI where the content of an XML schema document is located. Only a local file specified by a file scheme URI is supported.
AS relational-identifier
Specifies a name that can be used to refer to the XML object being registered. The relational name can be specified as a two-part SQL identifier consisting of the relational schema and name separated by a period, for example "JOHNDOE.EMPLOYEEDTD". If no relational schema is specified, the default relational schema defined in the special register CURRENT SCHEMA is used. If no name is specified, one is generated automatically.
DTD
Specifies that the object being registered is a Data Type Definition document (DTD).
EXTERNAL ENTITY
Specifies that the object being registered is an external entity.

Examples

  1. Given this sample XML document which references an external entity:
    <?xml version="1.0" standalone="no" ?>
    <!DOCTYPE copyright [
      <!ELEMENT copyright (#PCDATA)>
      
    ]>
    <copyright>c</copyright>
    Before this document can be successfully inserted into an XML column, the external entity needs to be registered. The following command registers an entity where the entity content is stored locally in C:\TEMP:
    REGISTER XSROBJECT 'http://www.xmlwriter.net/copyright.xml'
       FROM 'c:\temp\copyright.xml' EXTERNAL ENTITY
  2. Given this XML document fragment which references a DTD:
    <!--inform the XML processor
      that an external DTD is referenced-->
    <?xml version="1.0" standalone="no" ?>
    
    <!--define the location of the
      external DTD using a relative URL address-->
    <!DOCTYPE document SYSTEM "http://www.xmlwriter.net/subjects.dtd">
    
    <document>
      <title>Subjects available in Mechanical Engineering.</title>
      <subjectID>2.303</subjectID>
        <subjectname>Fluid Mechanics</subjectname>
    	...
    Before this document can be successfully inserted into an XML column, the DTD needs to be registered. The following command registers a DTD where the DTD definition is stored locally in C:\TEMP and the relational identifier to be associated with the DTD is "TEST.SUBJECTS":
    REGISTER XSROBJECT 'http://www.xmlwriter.net/subjects.dtd'
       FROM 'file:///c:/temp/subjects.dtd' AS TEST.SUBJECTS DTD
  3. Given this sample XML document which references a public external entity:
    <?xml version="1.0" standalone="no" ?>
    <!DOCTYPE copyright [
      <!ELEMENT copyright (#PCDATA)>
      
    ]>
    <copyright>c</copyright>
    Before this document can be successfully inserted into an XML column, the public external entity needs to be registered. The following command registers an entity where the entity content is stored locally in C:\TEMP:
    REGISTER XSROBJECT 'http://www.w3.org/xmlspec/copyright.xml'
       PUBLIC '-//W3C//TEXT copyright//EN' FROM 'file:///c:/temp/copyright.xml'
       EXTERNAL ENTITY