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

interleave — interleave Pattern

Class:

pattern

Synopsis

element interleave
{
   (
      attribute ns { text }?,
      attribute datatypeLibrary { xsd:anyURI }?,
      attribute * - (rng:* | local:*) { text }*
   ),
   (
      ( element * - rng:* { ... }* )
    & (
         element element { ... }
       | element attribute { ... }
       | element group { ... }
       | element interleave { ... }
       | element choice { ... }
       | element optional { ... }
       | element zeroOrMore { ... }
       | element oneOrMore { ... }
       | element list { ... }
       | element mixed { ... }
       | element ref { ... }
       | element parentRef { ... }
       | element empty { ... }
       | element text { ... }
       | element value { ... }
       | element data { ... }
       | element notAllowed { ... }
       | element externalRef { ... }
       | element grammar { ... }
      )+
   )
}

May be included in:

attribute, choice, define, element, except, group, interleave, list, mixed, oneOrMore, optional, start, zeroOrMore.

Compact syntax equivalent:

pattern&pattern

Description:

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

interleave is 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 allows these two combinations , but also element "b1" followed by "a" followed by "b2". It allows any 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 describe mixed content models where text is interleaved between elements. A shortcut (the mixed pattern) has been defined for this case.

Restrictions:

  • The interleave pattern cannot be used within a list.

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

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

Example:

     <element name="character">
      <interleave>
       <attribute name="id"/>
       <element name="name">
        <text/>
       </element>
       <element name="born">
        <text/>
       </element>
       <element name="qualification">
        <text/>
       </element>
      </interleave>
     </element>

    <element name="title">
     <interleave>
      <attribute name="xml:lang"/>
      <zeroOrMore>
       <element name="a">
        <attribute name="href"/>
        <text/>
       </element>
      </zeroOrMore>
      <text/>
     </interleave>
    </element>
			

Attributes:

datatypeLibrary

The datatypeLibrary attribute defines the default datatype library. The value of datatypeLibrary is inherited.

ns

The ns attribute defines the default namespace for the elements defined in a portion of schema. The value of ns is inherited.


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.