Before moving on to text patterns and mixed content, the
interleave
pattern deserves more attention. As
already noted, calling these content models unordered is misleading.
Although no order is required by the schema, the nodes will be
ordered in instance documents. The order in which they appear in the
document can be significant to the applications.
Going back to the example of first and last names: any application managing names will need to know which is a first name and which is a last name. With a little additional effort, they can get the information about whether the first name comes before or after the last name in a XML document. The friendliest of these applications might also want to know whether you prefer to be called by your first or last name first. Do you need to add an additional information item to the schema to carry this information when you could just rely on the order of these elements in the instance document?
In other words, defining content using interleave
patterns can be seen as degrading the usefulness of a schema because
it looks like the information about the order in which the elements
were found will be stripped from the document. That
isn’t a real problem; XML processors will still
present all the order information to your application. In fact, a
content model defined with interleave
patterns
allows more combinations than a content model that uses
group
patterns. Thus, with its additional
combinations, the interleave
patterns can let
document creators provide additional information that would otherwise
disappear into a fixed structure.
The one downside to using
interleave
patterns is that the freedom with which they can be used is
unfortunately specific to RELAX NG. If you need to insure that it
will also be possible to model your vocabulary with a more rigid
schema language such as W3C XML Schema, you will often have to
restrict the usage of interleave
patterns in your
RELAX NG schemas.
18.191.34.169