WebSphere Message Brokers
File: ad10430_
Writer: Terry Cowling

Concept topic

This build: July 31, 2007 21:23:50

Message model objects: type inheritance

The XML Schema language allows a type definition to be based on another type definition. In this way, a hierarchy of types can be constructed. This topic outlines the concepts of type inheritance, and highlights some important issues relating to substitution.

A full discussion of XML Schema type inheritance can be found on the World Wide Web Consortium (W3C) Web site, or in numerous books on XML schema.

Restriction and extension

A type is a restriction of its base type if elements of the derived type have a smaller range of legal values (or legal type members) than elements of the base type.

A type is an extension of its base type if elements of the derived type have a wider range of legal values (or legal type members) than elements of the base type.

Special rules apply to the derivation of simple types. A simple type cannot extend another simple type. This ensures that restrictions imposed by a simple type cannot be removed by deriving another simple type from it.

However, a complex type is allowed to extend a simple type. This does not affect the range of legal values of the simple type, but it does allow attributes to be added. The result of extending a simple type is always a complex type containing zero or more attributes.

Controlling type inheritance

The final attribute on a complex type can take three values, with the following effects:

Type inheritance and substitution

XML Schema provides two different substitution mechanisms, both of which use type inheritance information to allow or disallow substitutions.

Element substitution is controlled by substitution groups, and element substitution can be blocked or allowed for extension and restriction by settings on either the element itself, or on the element's type.

Type substitution allows the type of the element to be defined within the instance document, using the xsi:type attribute on the element, so that the element's real type is not known until the element has been partly parsed. This mechanism can also be blocked or allowed based on the derivation method of the types involved.

Notices | Trademarks | Downloads | Library | Support | Feedback

Copyright IBM Corporation 1999, 2007Copyright IBM Corporation 1999, 2007. All Rights Reserved.
This build: July 31, 2007 21:23:50

ad10430_ This topic's URL is: