function
| 
                
Library: XML schema (OMXMLSCHEMA)
 Import : omxmlschema.xmd  | 
              
 Returns: a markup sink ready to receive parsed markup for validation  | 
            
export dynamic markup sink function
   validator          against value schema-type     schema-instance
             case-insensitive value switch          is-case-insensitive optional initial { false }
                          via value entity-resolver resolver            optional
             report-errors-to value markup sink     errors              optional
    
 Use validator to validate an SGML or XML document instance against an XML schema. The schema
      must be specified as schema-instance argument to the function. The validator function
      sends all validation errors it finds into the errors sink if it is specified, or reports them in
      the log stream if the errors argument is not specified.
      
 In case the document instance specifies its schema using the xsi:schemaLocation or
        xsi:noNamespaceSchemaLocation attribute, you may also need to specify the resolver argument
        to help resolve and compile the schema.
      
 This program validates sgml input against a RELAX NG schema, reports any errors and keeps going:
          
import "omxmlschema.xmd" prefixed by w3c. define markup sink function error-reporter (value string sink s) as using output as s do markup-parse #current-input output "%c" done process local w3c.xml-schema-type example-schema set example-schema to w3c.compile-schema at "example-schema.xsd" using output as w3c.validator against example-schema report-errors-to error-reporter (#error) do xml-parse scan file "example-input.xml" output #content done