w3c.validated

function

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

Returns: the validated input, with validation errors inserted


Declaration
export markup source function
   validated                  value markup source   input-instance
                      against value schema-type     schema-instance
             case-insensitive value switch          is-case-insensitive optional
                          via value entity-resolver resolver            optional
    


Purpose

Use validated to validate an SGML or XML document instance against a W3C XML schema. This function reads the instance from its input-instance argument, validates it, inserts any validation markup errors it finds, and reproduces the modified instance. If you prefer to separate the handling of validation errors from the processing of original markup, use w3c.validator instead.

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.

Example

This program validates SGML input against a schema, reporting the validation errors together with the original markup errors and parsing the rest of the markup at the same time:

  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 sgml-parse document scan file "example-input.sgml"
        do markup-parse w3c.validated #content against example-schema case-insensitive true
           output "%c"
        done
     done
  
  
  element #implied
     output "%c"
            

Related Topics
Other Library Functions