Data Type Facets

Started by dhilipkumar, Mar 06, 2009, 03:08 PM

Previous topic - Next topic

dhilipkumar

Data Type Facets

Simple types (both built-in and derived) have facets. A facet is a single defining aspect that helps determine the set of values for a simple type. For example, length, minInclusive, and maxInclusive are common facets for the built-in data types. All of the facets for a simple type define the set of legal values for that simple type.

A facet is defined as an element. Each facet element has a fixed attribute that is a Boolean value. When a simple type is defined, you can prevent derivatives of that type from modifying the value of specified facets. To prevent modification of a facet, add the fixed attribute to the facet and set its value to true.

Facets can only appear once in a type definition except for enumeration and pattern facets. Enumeration and pattern facets can have multiple entries and are grouped together.
Example

The following example shows a simple type with the fixed attribute set to true which prevents the length from having a value other than 7.
Xml
Copy Code

<xs:simpleType name="Postcode">
<xs:restriction base="xs:string">
  <xs:length value="7" fixed="true"/>
</xs:restriction>
</xs:simpleType>



Source : MSDN

Quick Reply

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Note: this post will not display until it has been approved by a moderator.

Name:
Email:
Verification:
Please leave this box empty:
Type the letters shown in the picture
Listen to the letters / Request another image

Type the letters shown in the picture:

Shortcuts: ALT+S post or ALT+P preview