LibraryToggle FramesPrintFeedback

Like most major coding languages, XML Schema allows you to create data types that inherit some of their elements from other data types. This is called defining a type by extension. For example, you could create a new type called alienInfo, that extends the personalInfo structure defined in Example 3.4 by adding a new element called planet.

Types defined by extension have four parts:

  1. The name of the type is defined by the name attribute of the complexType element.

  2. The complexContent element specifies that the new type will have more than one element.

    [Note]Note

    If you are only adding new attributes to the complex type, you can use a simpleContent element.

  3. The type from which the new type is derived, called the base type, is specified in the base attribute of the extension element.

  4. The new type’s elements and attributes are defined in the extension element, the same as they are for a regular complex type.

For example, alienInfo is defined as shown in Example 3.13.


Comments powered by Disqus
loading table of contents...