by Eric van der Vlist is published by O'Reilly & Associates (ISBN: 0596004214)


Fixed Values

Sometimes documents need to include specific values for particular content. The value pattern can check fixed values, such as version identifiers of XML vocabularies. The syntax and semantics of the value pattern are straightforward: the pattern is matched only if the value found in the instance document matches the value specified in the value pattern. For example, if you want a highly specialized vocabulary to describe the book with the ISBN number 0836217462 and only this specific book, you can replace the text pattern with a value pattern and write:

<element name="isbn">
  <value>0836217462</value>
</element>

or, using the compact syntax:

element isbn {"0836217462"}

and the schema will validate a book with a ISBN number equal to 0836217462 and refuse any other ISBN number.


This text is released under the Free Software Foundation GFDL.