Purpose | This element is a restriction facet for pattern matching, i.e. for constraining the value space in such a way that only literals matching the specified pattern (regular expression) are allowed for the lexical space. |
Parent element | xs:restriction |
Child elements | None |
Attributes | value |
Restrictions |
The following restriction applies for the
|
Name | Type | Description |
---|---|---|
value |
xs:string |
The value attribute
allows you to specify a regular expression as defined in
http://www.w3.org/TR/xmlschema-2/#dt-regex
as a pattern that all members of the value space must match.
|
This simple example shows the application of the xs:pattern
element for the definition of a German zip code, which consists of five decimal
digits:
<xs:simpleType name="german-zipcode"> <xs:restriction base='string'> <xs:pattern value='[0-9]{5}'/> </xs:restriction> </xs:simpleType>