XSD SchemaLesson 87Free preview
XSD Restrictions
This lesson is part of XML · All levels
Summary
<xs:restriction> limits the value of the built-in type to comply with business rules, such as text length, number range, or list of allowed values. The boundary elements within it are called facets, for example pattern, length, minInclusive, and enumeration. Restrictions can be applied to simple type wrapped.
Key points
- Restriction reduces the base type through the base attribute and then adds the facet
- Enumeration provides a list of values that can be used
- Pattern using regular expression style XPath
- MinInclusive/maxInclusive and minLength/maxLength set the value limit
- Facet can only be used on the type that supports it, for example length not for xs:date
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.