XMLType.schemaValidate — Validates the schema based XMLType instance against its schema and signals an error in case of failed validation.


XMLType.schemaValidate ( );


The member function signals an error if called for a non-schema based instance. If an instance is schema-based but the validation has already been done, the call has no effect. Otherwise, a schema-based instance is validated against its schema. If the validation fails, an error is signalled. If the validation is successful then a special internal "validated"flag is set.

Return Types

The function returns a string that contains a validation log if an instance has not been validated before, otherwise it returns null or signals an error.


Example24.559.Failed schema validation

The example creates an XMLType instance that is a document with a single element node"bad" and declared schema "file://xmlschema/test0001/clean.xsd" that does not match actual content of the document. The call of schemaValidate() signals an error.

select XMLType('<bad />', 'file://xmlschema/test0001/clean.xsd').schemaValidate();

*** Error 42000: [Virtuoso Driver][Virtuoso Server]Top-level element name <q> is unknown
at line 76 of load 'XmlType.sql':
select XMLType('<bad />', 'file://xmlschema/test0001/clean.xsd').schemaValidate()