XSR_ADDSCHEMADOC

The XSR_ADDSCHEMADOC stored procedure adds every XML schema other than the primary XML schema document to the XSR.

Authorization

Each XML schema in the XSR can consist on one or more XML schema documents. When an XML schema consists of multiple documents, you need to call XSR_ADDSCHEMADOC for the additional documents.

The privileges held by the authorization ID of the statement must include the following:
  • The following system authorities:
    • The system authority *EXECUTE on the service program associated with the procedure,
    • The system authority *EXECUTE on the SYSPROC library,
    • The system authority *EXECUTE on the library containing the *SQLXSR object, and
    • The ALTER privilege for the *SQLXSR object.
  • Start of changeDatabase administrator authorityEnd of change
The privileges held by the authorization ID of the statement must include at least one of the following:
  • For the XSROBJECTCOMPONENTS and XSROBJECTHIERARCHIES catalog tables:
    • The INSERT privilege on the table, and
    • The system authority *EXECUTE on library QSYS2.
  • Start of changeDatabase administrator authorityEnd of change

The user ID of the caller of the procedure must have the EXECUTE privilege on the XSR_ADDSCHEMADOC stored procedure and must be the definer of the XSR object as recorded in the XSROBJECTS catalog table.

Syntax

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

Description

The schema is SYSPROC.

rschema
An input parameter of type VARCHAR(128) that specifies the SQL schema for the XML schema. It must be a valid SQL identifier. The SQL schema is one part of the qualified name used to identify this XML schema in the XSR. (The other part of the name is supplied by the name parameter). This parameter can have the NULL value which indicates that name is implicitly qualified based on the rules specified in Qualification of unqualified object names.
If rschema is specified, it cannot be QSYS, QSYS2, SYSIBM, SYSPROC, or QTEMP.
name
An input parameter of type VARCHAR(128) that specifies the name of the XML schema. It must be a valid SQL identifier. The complete name for the XML schema is rschema.name. The XML schema must already exist as a result of calling the XSR_REGISTER stored procedure and XML schema registration cannot yet be completed. This parameter cannot have the NULL value.
schemalocation
An input parameter of type VARCHAR(1000), which can have the NULL value, that indicates the schema location of the primary XML schema document to which the XML schema document is being added. 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. The document that references the schemalocation must use a valid URI format.
content
An input parameter of type BLOB(30M) that contains the content of the XML schema document being added. This argument cannot have the NULL value; an XML schema document must be supplied. The content of the XML schema document must be encoded in UTF-8.
docproperty
An input parameter of type BLOB(5M) that indicates the properties for the XML schema document being added. This argument can have the NULL value; otherwise, the value is an XML document.

Example

The following example calls the XSR_ADDSCHEMADOC stored procedure:

  CALL SYSPROC.XSR_ADDSCHEMADOC(
    'MyLib',
    'MySchema',
    'http://myschema/addschema1.xsd',
    :schema_content,
    :schema_docproperties)