LibraryLink ToToggle FramesPrintFeedback

Simple Types Defined by Restriction

XML Schema allows you to create simple types by deriving a new type from another primitive type or simple type. Simple types are described using a simpleType element.

The new types are described by restricting the base type with one or more facets. These facets limit the possible valid values that can be stored in the new type. For example, you could define a simple type, SSN, which is a string of exactly 9 characters.

Each of the primitive XML Schema types has their own set of optional facets.

To define your own simple type do the following:

Example 12.1 shows the syntax for describing a simple type.


The type description is enclosed in a simpleType element and identified by the value of the name attribute. The base type from which the new simple type is being defined is specified by the base attribute of the xsd:restriction element. Each facet element is specified within the restriction element. The available facets and their valid settings depend on the base type. For example, xsd:string has a number of facets including:

  • length

  • minLength

  • maxLength

  • pattern

  • whitespace

Example 12.2 shows the definition for a simple type that represents the two-letter postal code used for US states. It can only contain two, uppercase letters. TX is a valid value, but tx or tX are not valid values.


FUSE Services Framework maps user-defined simple types to the Java type of the simple type’s base type. So, any message using the simple type postalCode, shown in Example 12.2, is mapped to a String because the base type of postalCode is xsd:string. For example, the WSDL fragment shown in Example 12.3 results in a Java method, state(), that takes a parameter, postalCode, of String.


By default, FUSE Services Framework does not enforce any of the facets that are used to restrict a simple type. However, you can configure FUSE Services Framework endpoints to enforce the facets by enabling schema validation.

To configure FUSE Services Framework endpoints to use schema validation set the schema-validation-enabled property to true. Example 12.4 shows the configuration for a service provider that uses schema validation


For more information on configuring FUSE Services Framework see Configuring and Deploying Endpoints.