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.
Let's say that we want to add some flexibility to the name element so we can accept both:
<name>Lucy</name> |
and:
<name>
<first>Charles</first>
<middle>M</middle>
<last>Schulz</last>
</name> |
and
<name>
<first>Peppermint</first>
<last>Patty</last>
</name> |
To express this flexibility, we will use a choice pattern which will accept either a text node or a group of three elements (one of which is optional):
<element name="name">
<choice>
<text/>
<group>
<element name="first"><text/></element>
<optional>
<element name="middle"><text/></element>
</optional>
<element name="last"><text/></element>
</group>
</choice>
</element> |
The compact syntax uses a logical "or" character ("|") to denote choices:
element name {
text|(
element first{text},
element middle{text}?,
element last{text}
)} |
Note that we had to use parentheses (..) to mark the boundary of the group pattern.
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.