DBMS_XMLSCHEMA_UTIL

The DBMS_XMLSCHEMA_UTIL package provides an interface for XML schema validation.

This chapter contains the following topics:

See Also:

Oracle XML DB Developer's Guide

DBMS_XMLSCHEMA_UTIL Security Model

Applications must have the EXECUTE privilege on the DBMS_XMLSCHEMA_UTIL package

Summary of DBMS_XMLSCHEMA_UTIL Subprograms

This topic lists the DBMS_XMLSCHEMA_UTIL subprograms in alphabetical order and briefly describes them.

Table 1 DBMS_XMLSCHEMA_UTIL Package Subprograms

Subprogram Description
CONFORMING Function Validates an XML document against a schema
VALIDATE Procedure Validates an XML document against a schema

CONFORMING Function

This function is used to validate an XML document against a schema.

Syntax

DBMS_XMLSCHEMA_UTIL.CONFORMING (
   doc             IN XMLTYPE,
   sch             IN XMLTYPE)
RETURN NUMBER;

Parameters

Table 2 CONFORMING Function Parameters

Parameter Description
doc The XML instance
sch The XML schema

Function Exceptions

The exceptions of DBMS_XMLSCHEMA_UTIL.CONFORMING function are as follows:

Note: The function takes an xml data instance and xml schema instance. The user does not have to register the schema.

Example: The document conforms to the schema

SELECT DBMS_XMLSCHEMA_UTIL.CONFORMING(
     XMLType('<A/>'),
     XMLType(
    '<xs:schema xmlns:xs="http://www.w
3.org/2001/XMLSchema">
      <xs:element name="A" type="xs:string"/>
     </xs:schema>')) "LSX CODE"
    FROM DUAL;

VALIDATE Procedure

This procedure is used to validate an XML document against a schema.

Syntax

DBMS_XMLSCHEMA_UTIL.VALIDATE (
   doc             IN XMLTYPE,
   sch             IN XMLTYPE);

Parameters

Table 3 VALIDATE Procedure Parameters

Parameter Description
doc The XML instance
sch The XML schema

Procedure Exceptions

The exceptions of DBMS_XMLSCHEMA_UTIL.VALIDATE procedure are as follows:

Note: The procedure takes an xml data instance and xml schema instance. The user does not have to register the schema.

Example: The document conforms to the schema

BEGIN
      DBMS_XMLSCHEMA_UTIL.VALIDATE(
         XMLType('<A/>'),
         XMLType(
                 '<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
                  <xs:element name="A" type="xs:string"/>
                  </xs:schema>'));
END;
/