Retrieving the XML schema of an XML document

The following example shows how the XML schema associated with an XML document can be retrieved from the XML schema repository.

Example 1: Retrieve the object ID of the XML schema of an XML document:

SELECT DOC, XMLXSROBJECTID(DOC)
   FROM T

Example 2: Retrieve the object ID and the two-part SQL identifier of the XML schema of an XML document:

SELECT XMLXSROBJECTID(DOC), 
   CAT.OBJECTSCHEMA, CAT.OBJECTNAME 
   FROM T, SYSCAT.XSROBJECTS AS CAT 
   WHERE XMLXSROBJECTID(DOC) = CAT.OBJECTID