The output RELAX NG schema is designed to constrain only
the value of selector
, nothing
else. Thus it allows any outermost (“root”)
element from any namespace (including the null namespace),
which is allowed to have any attributes from any namespace
(including the null namespace) and any children including text
intermingled with any number of any element from any namespace
(including the null namespace); each child element in turn is
also allowed to have any attributes from any namespace
(including the null namespace) and any children including text
intermingled with any number of any element from any namespace
(including the null namespace), except
that any selector
attribute on
any element must match the generated regular expression. Thus
the only error messages generated by validation against the
schema assert that the value of a selector
attribute is not a CSS3
selector.[40]
The main declaration of the RELAX NG schema is shown in
Figure 1, “RELAX NG schema constraint”; the placeholder
GENERATED_REGEXP_HERE
indicates
where in the schema the generated regular expression is
placed. The schema is shown in the compact syntax although it
is generated in the XML syntax.
Figure 1. RELAX NG schema constraint
start = ANY ANY = element * { attribute * - selector { text }*, attribute selector { xsd:string { pattern = "GENERATED_REGEXP_HERE" } }?, (text | ANY)* }
[40] Or, of course, messages indicating that the input document is not well-formed XML, but for our purposes here those are messages from a pre-validation XML parser, not from the validator itself.