Chapter 3 Building an XML model


Defining restriction facets

Facets are the constraints on the set of values of a simple type.

You can find these facets in the Detail, Enumerations and Patterns pages of a simple type restriction property sheet.

Restriction detail properties

The Detail page of a simple type restriction property sheet displays a range of facets:

Icon Facet Description

Length Exact number of characters or list items allowed. It must be equal to or greater than zero

Minimum length Minimum number of characters or list items allowed. It must be equal to or greater than zero

Maximum length Maximum number of characters or list items allowed. It must be equal to or greater than zero

Minimum exclusive Lower bound for numeric values. All values are greater than this value

Maximum exclusive Upper bound for numeric values. All values are lower than this value

Minimum inclusive Minimum value allowed for data type

Maximum inclusive Maximum value allowed for data type

Total digits Exact number of decimal digits allowed. It must be greater than zero

Fraction digits Maximum number of decimal digits in the fractional part

Whitespace Way of handling white spaces. If the value is Preserve, white spaces are unchanged. If the value is Replace, tabs, line feeds and carriage returns are replaced with spaces. If the value is Collapse, contiguous sequences of spaces are collapsed to a single space. Leading and trailing spaces are removed

A facet icon appears in the title bar of a facet property sheet.

WARNING! 

Caution
Facets only appear in the schema, within a simple type declaration (see Preview tab in the model property sheet).

Facet general properties

The General page of a facet property sheet displays the following properties:

Property Description
ID ID of the facet. Its value must be of type ID and unique within the model containing the facet
Value Value(s) of the facet
Fixed (check box) To prevent a modification of the facet value(s), select the Fixed property

Restriction enumerations properties

The Enumerations page of a simple type restriction property sheet allows you to enter a set of acceptable values for the simple type restriction.

Select F (for Fixed) at the end of a row if you want to prevent the modification of a value.

For example: the meetings simple type, based on the xs:gMonthDay data type, is restricted to the following dates: 01/20, 03/20, 05/20 and 07/20.


Generated schema:


Restriction patterns properties

The Patterns page of a simple type restriction property sheet allows you to enter the exact sequence of acceptable values for the simple type restriction.

Select F (for Fixed) at the end of a row if you want to prevent the modification of a value.

For example: the zipCode simple type, based on the xs:string data type, is restricted to the following pattern: two uppercase letters, from A to Z, followed by a five-digit number, each digit ranging from 0 to 9.


Generated schema:


 


Copyright (C) 2005. Sybase Inc. All rights reserved.