class LibXML::XML::RelaxNG

The XML::RelaxNG class is used to prepare RelaxNG schemas for validation of xml documents.

Schemas can be created from XML documents, strings 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_relaxng method providing the XML::RelaxNG object as parameter. The method will raise an exception if the document is not valid.

Basic Usage:

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

# prepare schema for validation
relaxng_schema = XML::RelaxNG.document(relaxng_document)

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

# validate
instance.validate_relaxng(relaxng_schema)