Skip to content

On anyElement

Syd Bauman edited this page Mar 5, 2024 · 4 revisions

The <anyElement> indicates the presence of any elements in a content model.

The optional @require attribute supplies a list of namespaces to one of which the permitted elements must belong.

The optional @except attribute supplies a list of namespaces or prefixed element names which are not permitted.

If the @except attribute is not present, the list of namespaces or prefixed element names which are not permitted is taken from the schema's @defaultExceptions attribute which defaults to 'http://www.tei-c.org/ns/1.0 teix:egXML' if not present.

The use of @require, @except, and @defaultExceptions allows for declarations that are contradictory or nonsensical such as:

  • a namespace both being required and not permitted;
  • a namespace being required and an element from a different namespace not permitted;
  • a namespace being required and a different namespace not permitted.

The <anyElement> translates to a pattern containing an <rng:element> with a name class. The name class is constructed as follows:

If the <anyElement> has a @require, then the name class consists of an <rng:nsName> for each required namespace URI with an <rng:exclude> for each not permitted element from this namespace. If the @require contains more than one namespace URI, the <rng:nsName> elements are combined within an <rng:choice>.

Otherwise the name class is an <rng:anyElement> with an <rng:exclude> that contains an <rng:name> for every excluded element and an <rng:nsName> for every excluded namespace.

Clone this wiki locally