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.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access