Deriving by Restriction

You can derive an element, simple type, or complex type by restriction to restrict the values of their base type.

  1. Open the property sheet of an element, simple type, or complex type, and select Restriction in the Derivation list.


    For elements and complex types, the Content field (and, in the case of an element, the Embedded type field) is set to Complex.

  2. Click the Properties tool to the right of the Derivation field to open the restriction property sheet, and complete the following fields on the General tab:

    Property

    Description

    ID

    ID of the simple type restriction. Its value must be of type ID and unique within the model containing the simple type restriction

    Base type

    Data type on which the restriction is based. Select a data type in the Base type list or with the Browse tool

    Embedded type [simple types only]

    If selected, the base type disappears and a simple type is created in the schema within the current simple type. Click Apply, and then the Properties tool beside the Embedded type box, to define a derivation and a base type for the embedded simple type.

  3. [optional - simple type restrictions only] Click the Detail tab and enter appropriate facets (constraints on the set of values of a simple type) for the restriction:

    Icon

    Facet

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

    Whitespace - Way of handling white spaces. You can choose from the following:
    • Preserve - white spaces are unchanged.

    • Replace - Tabs, line feeds and carriage returns are replaced with spaces.

    • Collapse - Contiguous sequences of spaces are collapsed to a single space. Leading and trailing spaces are removed.

    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

    You can optionally click the Properties tool to the right of each field to open the property sheet of the facet and enter 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

    To prevent a modification of the facet value(s), select the Fixed property

  4. [optional - simple type restrictions only] Click the Enumerations tab and enter a set of acceptable values. Select the F[ixed] check box 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:



  5. [optional - simple type restrictions only] Click the Patterns tab and enter one or more sequences of acceptable values. Select the F[ixed] check box 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:



  6. Click OK to close the restriction property sheet and return to the element, simple type, or complex type.