class LibXML::XML::Schema

The XML::Schema class is used to prepare XML Schemas for validation of xml documents.

Schemas can be created from XML documents, strinings or URIs using the corresponding methods (new for URIs).

Once a schema is prepared, an XML document can be validated by the XML::Document#validate_schema method providing the XML::Schema object as parameter. The method return true if the document validates, false otherwise.

Basic usage:

# parse schema as xml document
schema_document = XML::Document.file('schema.rng')

# prepare schema for validation
schema = XML::Schema.document(schema_document)

# parse xml document to be validated
instance = XML::Document.file('instance.xml')

# validate
instance.validate_schema(schema)