RELAX NG is a schema language for XML, an alternative to using DTDs. It is designed to be simple and easy to learn, and has both an XML syntax and a non-XML syntax. It supports datatyping and XML namespaces, and it integrates attributes into content models. It is specified by ISO/IEC 19757-2:2003.

Use the OMRELAXNG library when you want to validate input against a RELAX NG schema.


This program validates input against a RELAX NG schema, reports validation errors and keeps going:

  import "omrelaxng.xmd" prefixed by relaxng.
  define markup sink function
     report-errors (value string sink s)
     using output as s
     do markup-parse #current-input
        output "%c"
     local relaxng.relaxng-schema-type example-schema
     set example-schema to relaxng.compile-schema file "example-schema.rng"
     do xml-parse scan file "example-input.xml"
        using output as relaxng.validator against example-schema report-errors-to report-errors (#error)
           output #content

Usage Note

To use OMRELAXNG, you must import it into your program using an import declaration such as:

  import "omrelaxng.xmd" prefixed by relaxng.