>>-XMLXSROBJECTID--(--xml-value-expression--)------------------><
The XMLXSROBJECTID function returns the XSR object identifier
of the XML schema used to validate the XML document specified in the
argument. The XSR object identifier is returned as a BIGINT value
and provides the key to a single row in SYSCAT.XSROBJECTS.
- xml-value-expression
- Specifies an expression that results in a value with a data type
of XML. The resulting XML value must be an XML sequence with a single
item that is an XML document or the null value (SQLSTATE 42815). If
the argument is null, the function returns null. If xml-value-expression does
not specify a validated XML document, the function returns 0.
Note: - The XML schema corresponding to an XSR object ID returned by the
function might no longer exist, because an XML schema can be dropped
without affecting XML values that were validated using the XML schema.
Therefore, queries that use the XSR object ID to fetch further XML
schema information from the catalog views might return an empty result
set.
- Applications can use the XSR object identifier to retrieve additional
information about the XML schema. For example, the XSR object identifier
can be used to return the individual XML schema documents that make
up a registered XML schema from SYSCAT.SYSXSROBJECTCOMPONENTS, and
the hierarchy of XML schema documents in the XML schema from SYSCAT.XSROBJECTHIERARCHIES.
- Retrieve the XML schema identifier for the XML document XMLDOC
stored in the table MYTABLE.
SELECT XMLXSROBJECTID(XMLDOC) FROM MYTABLE
- Retrieve the XML schema documents associated with the XML document
that has a specific ID (in this case where DOCKEY = 1) in the table
MYTABLE, including the hierarchy of the XML schema documents that
make up the XML schema.
SELECT H.HTYPE, C.TARGETNAMESPACE, C.COMPONENT
FROM SYSCAT.XSROBJECTCOMPONENTS C, SYSCAT.XSROBJECTHIERARCHIES H
WHERE C.OBJECTID =
(SELECT XMLXSROBJECTID(XMLDOC) FROM MYTABLE
WHERE DOCKEY = 1)
AND C.OBJECTID = H.OBJECTID