relaxng.compile-error

catch name

Library: RELAX NG (OMRELAXNG)
Import : omrelaxng.xmd

Declaration
export catch compile-error (value integer error-code,
                            value string  error-message, 
                            value string  error-detail)
    


Purpose

The compile-error exception is thrown by compile-schema if the schema is not a valid RELAX NG schema. The following example demonstrates how compile-error can be used to make processing more robust.

  import "omrelaxng.xmd" prefixed by relaxng.
  
  process
     local relaxng.relaxng-schema-type example-schema
  
  
     do xml-parse scan file "example-input.xml"
        set example-schema to relaxng.compile-schema file "example-schema.rng"
  
        do markup-parse relaxng.validated #content against example-schema
           output "%c"
        done
  
      catch relaxng.compile-error (code, message, detail)
        log-message "Input processing will proceeed without validation because of a schema compilation error:%n"
                 || message
        do markup-parse #content
           output "%c"
        done
     done
  
  element #implied
     output "%c"
            

The error-code and error-message arguments of the catch can contain the following error codes and descriptions:

Related Topics