function
|
Library: RELAX NG (OMRELAXNG)
Import : omrelaxng.xmd |
Returns: compiled RELAX NG schema |
export relaxng-schema-type function
compile-schema value string source schema-input
via value entity-resolver resolver optional
Use compile-schema to compile a RELAX NG schema specified in XML format,
so that you may validate XML input against it. Compiling the schema also serves to validate the schema itself.
If the root document references other RELAX NG schema documents using the externalRef or
include constructs, compile-schema will try to resolve and load them using the
resolver argument, if provided.
If the schema is invalid and cannot be compiled, compile-schema throws the compile-error exception.
In this example we compile the schema "my-schema" and validate XML input against it, reporting any errors
along the way:
import "omrelaxng.xmd" prefixed by relaxng. process 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" do markup-parse relaxng.validated #content against example-schema output "%c" done done element #implied output "%c"