relaxng.compile-error
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:
- 1 — URIs with fragment identifiers are not supported.
- 3 — A pattern was encountered where an instance of NAME-CLASS-TYPE was expected.
- 8 — A REF node does not correspond to any visible DEFINE node.
- 9 — Encountered a circular DEFINE node.
- 11 — A circularity has been detected while fetching a resource.
- 13 — A disallowed path was encountered.
- 14 — STRING or DATA nodes must appear as alternatives in this context.
- 16 — Both children of an INTERLEAVE node cannot contain a TEXT node.
- 17 — The descendants of the two children of an INTERLEAVE node cannot have overlapping
NAME-CLASSes.
- 18 — Duplicate ATTRIBUTE nodes.
- 19 — The pattern for an ATTRIBUTE node should be text only.
- 101 — Failed to compile schema to a tree automaton.
- 102 — DATA parameters are not supported on built-in datatypes.
- 103 — The GRAMMAR node referenced by an INCLUDE node must have a START node if the
INCLUDE node has such a node.
- 104 — The GRAMMAR node referenced by an INCLUDE node is missing a DEFINE node the INCLUDE
node requires.
- 105 — A GRAMMAR node should not contain any patterns as children.
- 106 — A DEFINE node should be descendant of a GRAMMAR node.
- 107 — An ELEMENT or ATTRIBUTE node must contain a NAME either as an attribute or as a
child.
- 108 — An ELEMENT or ATTRIBUTE node must contain a NAME either as an attribute or as a
child, not both.
- 109 — An ANYNAME node should have at most one child.
- 110 — An NSNAME node should have at most one child.
- 111 — An node of type (node type) should not have any child nodes.
- 112 — A NOTALLOWED node should not have any child nodes.
- 113 — A TEXT node should not have any child nodes.
- 114 — A VALUE node should not have any child nodes.
- 115 — A REF or PARENTREF node should not have any child nodes.
- 116 — A EXTERNALREF node should not have any child nodes.
- 117 — An ELEMENT node should have at least one child.
- 118 — A CHOICE, GROUP, INTERLEAVE, LIST, MIXED, ONEORMORE, OPTIONAL, or
ZEROORMORE node should have at least one child.
- 119 — An EXCEPT node should have at least one child.
- 120 — A START node should have exactly one child.
- 121 — The TYPE attribute is required on a DATA node.
- 122 — The HREF attribute of an EXTERNALREF or INCLUDE node must be specified.
- 123 — The NAME attribute of a DEFINE, PARAM, PARENTREF, or REF node must be specified.
- 124 — The NAME attribute of a DEFINE, PARAM, PARENTREF or REF node cannot be a
qualified name.
- 125 — A disallowed attribute was encountered.
- 126 — A DATA node should have at most one child.
- 127 — A DEFINE node must specify at least one pattern.
- 128 — The NAME attribute is malformed.
- 129 — The attribute must contain a valid URI.
- 130 — The attribute must contain an absolute URI.
- 131 — The attribute must contain a URI with no fragment identifier.
- 132 — Foreign elements are not allowed in this position.
- 133 — An INCLUDE node must reference a GRAMMAR.
- 134 — An ATTRIBUTE node must contain a single child node.
- 135 — An ANYNAME node cannot contain an EXCEPT node that contains an ANYNAME node.
- 136 — An NSNAME node cannot contain an EXCEPT node that contains either an ANYNAME node or
a NSNAME node.
- 137 — The NAME child node of an ATTRIBUTE node refers to the reserved XMLNS namespace.
- 138 — Datatype library URI (library uri) does not refer to any registered library.
- 139 — A GRAMMAR node must have a START child node in this context.
- 140 — A duplicated DEFINE node without a COMBINE attribute has already been encountered.
- 141 — The COMBINE attribute of identically-named DEFINE nodes must be consistent.
- 142 — There can be only one START node whose COMBINE attribute is empty.
- 143 — The child of a DATA node must be an EXCEPT node.
- 144 — The TYPE attribute cannot be a qualified name.
- 145 — An ANYNAME pattern node must contain a NAME-CLASS node.
- 146 — The COMBINE attribute must be either CHOICE, INTERLEAVE, or empty.
- 147 — A NAME attribute appears on an ELEMENT that should not have one.
- 148 — The COMBINE attribute of START nodes must be consistent.
- 149 — Datatype (datatype name) could not be constructed.
- 201 — A NAME is malformed.
- 202 — An unknown namespace prefix was encountered.
- 203 — ATTRIBUTE nodes having a NAME-CLASS node of an infinite type (e.g., ANYNAME) must be repeated.
- 501 — Encountered the end of input.
- 502 — The attribute is not allowed on element (element name).
- 503 — The attribute value is invalid for attribute of element (element name).
- 504 — A start tag for element (element name) was encountered, but not expected.
- 505 — The required attributes for element (element name) were not all specified.
- 506 — An end tag for element (element name) cannot appear in this position.
- 507 — The text value (text value) does not match the required pattern.
- 508 — The external text entity (entity name) has not been resolved.