Name

(pattern) — Container

Synopsis

“(” pattern “)”

Restrictions

pattern

May be included in

(pattern), attribute, datatypeName param exceptPattern, element, list, mixed, pattern&pattern, pattern*, pattern+, pattern,pattern, pattern?, pattern|pattern

XML syntax equivalent

None

Description

The (pattern) container is useful when grouping together patterns combined using, (ordered group), | (choice), or & (interleave). This container is treated itself as a pattern and may be combined with other patterns or quantified using qualifiers.

The operator (, | &) used within the (pattern) container defines how the subpatterns are combined, and different operators can’t be mixed at the same level.

Even when such a container isn’t required, it is often used to improve the readability of a schema.

Example

 element name {
 text|(
  element first{text},
  element middle{text}?,
  element last{text}
 )}
 
element foo {
 element out {empty} &
 (
  element in1 {empty},
  element in2 {empty}
 )
}

Get RELAX NG now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.