w3c.compile-schema

function

Library: XML schema (OMXMLSCHEMA)
Import : omxmlschema.xmd

Returns: compiled schema


Declaration
export xml-schema-type function
   compile-schema           from value     string source              schema-input optional
                              at value     string                     schema-uri   optional
                             via value     entity-resolver            resolver     optional
                            into value     xml-schema-type            collection   optional
                  with-libraries read-only datatypes.datatype-library libraries    optional
    


Purpose

Use compile-schema to compile a W3C XML schema specified in W3C XML Schema specification, so that you may validate XML input against it.

If the schema is invalid and cannot be compiled, compile-schema throws the compile-error exception.

Example

In this example we compile the schema "my-schema" and validate XML input against it, reporting any errors along the way:

  import "omxmlschema.xmd" prefixed by w3c.
  
  process
     local w3c.xml-schema-type example-schema
  
     set example-schema to w3c.compile-schema at "example-schema.xsd"
  
     do xml-parse scan file "example-input.xml"
        do markup-parse w3c.validated #content against example-schema
           output "%c"
        done
     done
  
  element #implied
     output "%c"
            

Other Library Functions