Complete XML Schema Reference
The restriction element defines restrictions on a simpleType, simpleContent, or complexContent definition.
(The ? sign declares that the element can occur zero or one time inside the restriction element)
| Attribute | Description |
|---|---|
| id | Optional. Specifies a unique ID for the element |
| base |
Required. Specifies the name of a built-in data type, simpleType element, or complexType element defined in this schema or another schema |
| any attributes | Optional. Specifies any other attributes with non-schema namespace |
This example defines an element called "age" with a restriction. The value of age can NOT be lower than 0 or greater than 100:
This example also defines an element called "initials". The "initials" element is a simple type with a restriction. The only acceptable value is THREE of the LOWERCASE OR UPPERCASE letters from a to z:
This example defines an element called "password". The "password" element is a simple type with a restriction. The value must be minimum five characters and maximum eight characters:
This example shows a complex type definition using restriction. The complex type "Norwegian_customer" is derived from a general customer complex type and its country element is fixed to "Norway":
Complete XML Schema Reference
| WEB HOSTING |
|---|
| Best Web Hosting |
| PHP MySQL Hosting |
| Best Hosting Coupons |
| UK Reseller Hosting |
| Cloud Hosting |
| Top Web Hosting |
| $7.95/mo SEO Hosting |
| Premium Website Design |
| WEB BUILDING |
|---|
| XML Editor - Free Trial! |
| FREE Website BUILDER |
| Free Website Templates Free CSS Templates |
| Make Your Own Website |
| W3SCHOOLS EXAMS |
|---|
|
Get Certified in: HTML, CSS, JavaScript, XML, PHP, and ASP |
| W3SCHOOLS BOOKS |
|---|
|
New Books: HTML, CSS JavaScript, and Ajax |
| STATISTICS |
|---|
|
Browser Statistics Browser OS Browser Display |
| SHARE THIS PAGE |
|---|