RELAX NG by Eric van der Vlist will be published by O'Reilly & Associates (ISBN: 0596004214)

You are welcome to use our annotation system to give your feedback.


Name

pattern&pattern — interleave Pattern

Class:

pattern

Synopsis

pattern ("&" 
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:

interleave

Description:

The interleave pattern "interleaves" sub-patterns ; it allows their leaves to be mixed in any relative order.

interleave is about more than defining unordered groups, as we can see on the following example. Consider element "a" and the ordered group of element "b1" and "b2". An unordered group of these two patterns would only allow element "a" followed by elements "b1" and "b2" or elements "b1" and "b2 followed by element "a". An interleave of these two patterns does allows these two combinations but also element "b1" followed by "a" followed by "b2": a combination where the element "a" has been "interleaved" between elements "b1" and "b2".

The interleave behavior is the behavior applied to attribute patterns even when they are embedded in (ordered) group patterns. The reason for this is that XML 1.0 specifies that the relative order of attributes is not significant.

Another case where interleave patterns are often needed is to described mixed content models : content models where text is interleaved between elements. A shortcut (the mixed pattern) has been defined for this case.

Any number of patterns may be combined using the & operator when using this construct, but one should note that different operators (,, | and &) cannot be mixed at the same level.

Restrictions:

  • The pattern&pattern pattern cannot be used within a list.

  • Elements within a pattern&pattern pattern cannot have overlapping name classes.

  • There must be at most one "text" pattern in each set of patterns combined by the pattern&pattern

Example:


   element character {
    attribute id {text}&
    element name {text}&
    element born {text}&
    element qualification {text}}
 
 element foo {
  element out {empty} &
  (
   element in1 {empty},
   element in2 {empty}
  )
 }
      

You are welcome to use our annotation system to give your feedback.
[Annotations for this page]
All text is copyright Eric van der Vlist, Dyomedea. During development, I give permission for non-commercial copying for educational and review purposes. After publication, all text will be released under the Free Software Foundation GFDL.