XSR_REGISTER procedure

The XSR_REGISTER procedure is the first procedure to be called as part of the XML schema registration process, which registers XML schemas with the XML schema repository (XSR).

Read syntax diagramSkip visual syntax diagramXSR_REGISTER(rschema,name,schemalocation,content,docproperty)

The schema is SYSPROC.

Authorization

The authorization ID of the caller of the procedure must have at least one of the following authorities:
  • DBADM authority.
  • IMPLICIT_SCHEMA database authority if the SQL schema does not exist.
  • CREATEIN privilege if the SQL schema exists.
rschema
An input and output argument of type VARCHAR (128) that specifies the SQL schema for the XML schema. The SQL schema is one part of the SQL identifier used to identify this XML schema in the XSR. (The other part of the SQL identifier is supplied by the name argument.) This argument can have a null value, which indicates that the default SQL schema, as defined in the CURRENT SCHEMA special register, is used. Rules for valid characters and delimiters that apply to any SQL identifier also apply to this argument. Relational schemas that begin with the string 'SYS' must not be used for this value. XSR objects will not experience name collisions with database objects that exist outside of the XSR, because XSR objects occur in a different namespace than objects outside of the XML schema repository.
name
An input and output argument of type VARCHAR (128) that specifies the name of the XML schema. The complete SQL identifier for the XML schema is rschema.name and should be unique among all objects in the XSR. This argument accepts a null value. When a null value is provided for this argument, a unique value is generated and stored within the XSR. Rules for valid characters and delimiters that apply to any SQL identifier also apply to this argument.
schemalocation
An input argument of type VARCHAR (1000), which can have a null value, that indicates the schema location of the primary XML schema document. This argument is the external name of the XML schema, that is, the primary document can be identified in the XML instance documents with the xsi:schemaLocation attribute.
content
An input parameter of type BLOB (30M) that contains the content of the primary XML schema document. This argument cannot have a null value; an XML schema document must be supplied.
docproperty
An input parameter of type BLOB (5M) that indicates the properties for the primary XML schema document. This parameter can have a null value; otherwise, the value is an XML document.

Examples

  • Example 1: The following example shows how to call the XSR_REGISTER procedure from the command line:
       CALL SYSPROC.XSR_REGISTER(
         'user1',
         'POschema',
         'http://myPOschema/PO.xsd',
         :content_host_var,
         :docproperty_host_var)
  • Example 2: The following example shows how to call the XSR_REGISTER procedure from a Java™ application program:
    
       stmt = con.prepareCall("CALL SYSPROC.XSR_REGISTER (?, ?, ?, ?, ?)");
       String xsrObjectName = "myschema1";
       String xmlSchemaLocation = "po.xsd";
       stmt.setNull(1, java.sql.Types.VARCHAR);
       stmt.setString(2, xsrObjectName);
       stmt.setString(3, xmlSchemaLocation);
       stmt.setBinaryStream(4, buffer, (int)length);
       stmt.setNull(5, java.sql.Types.BLOB);
       stmt.registerOutParameter(1, java.sql.Types.VARCHAR);
       stmt.registerOutParameter(2, java.sql.Types.VARCHAR);
       stmt.execute();