by Eric van der Vlist is published by O'Reilly & Associates (ISBN: 0596004214)
Defining a named pattern is easy, as shown the earlier example, but referencing a named pattern rather than defining it again is even simpler.
Using the XML syntax, references to named patterns defined elsewhere in the schema are done using a ref element. For instance, to define the author element, use a reference to the name-element pattern:
<element name="author">
<attribute name="id"/>
<ref name="name-element"/>
<optional>
<element name="born">
<text/>
</element>
</optional>
<optional>
<element name="died">
<text/>
</element>
</optional>
</element> |
To reference a named pattern in the compact syntax, just use its name directly:
element author {
attribute id { text },
name-element,
element born { text }?,
element died { text }?
} |
The same approach can reference the common-content named pattern:
<element name="author">
<ref name="common-content"/>
<optional>
<element name="died">
<text/>
</element>
</optional>
</element> |
or:
element author {
common-content,
element died { text }?
} |
This text is released under the Free Software Foundation GFDL.