Enumerations

An enumeration is a choice between several values. Enumerations are thus written in RELAX NG by combining the choice pattern with the value pattern. In our library, a good candidate for an enumeration is the available attribute, which can be defined as:

<attribute name="available">
 <choice>
  <value>available</value>
  <value>checked out</value>
  <value>on hold</value>
 </choice>
</attribute>

or:

attribute available {"available"|"checked out"|"on hold"}

This definition validates values such as "available“, "checked out“, and "on hold“. It also validates values such as " available “, "checked out “, or even " on hold " with multiple spaces, tabs or carriage returns between "on" and "hold" or "checked" and "out“. You will see the reason for this behavior—and how to change it if needed—in the next section.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.143.248.211