Name
rng:interleave — Matches patterns mixed in any order
XML syntax example
<grammar xmlns="http://relaxng.org/ns/structure/1.0"> <start> <element name="name"> <ref name="name"/> </element> </start> <define name="name"> <interleave> <element name="given"> <text/> </element> <optional> <element name="middle"> <text/> </element> </optional> <element name="family"> <text/> </element> </interleave> </define> </grammar>
Compact syntax example
start = element name { name } name = element given { text }&
element middle { text }?&
element family { text }
Parents
attribute
, choice
((
)
and |
), define
(name of pattern followed by
=
), element
, except
(-
), group
((
)
and ,
), interleave
(&
), list
, mixed
, oneOrMore
(+
), optional
(?
), start
(start
followed by =
), zeroOrMore
(*
)
Description
The interleave
pattern
interleaves its children. Its most common use is for matching
unordered content. interleave
containing a text
node matches
mixed content. An interleave
element may contain only one child element that directly or
indirectly contains a text
element (this avoids combinatorial explosion). Also, it is not
possible to interleave data
,
value
, or list
patterns with child element
or text
patterns. RELAX NG does not require
deterministic content models as do XML Schema and DTDs.
See also
§8, group
, mixed
, oneOrMore
, optional
, zeroOrMore
Get XML Pocket Reference, 3rd Edition 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.