Home > Articles > Web Services > XML

XML Schema Complex Types

  • Print
  • + Share This
The XML Schema Recommendation provides mechanisms for validating distinct datum (via simple types) and the composite structure of data (via complex types). This article is an overview of complex types.
From the author of

Introduction

A schema—database, XML, or otherwise—specifies structure for data. For the most part, the XML Schema Recommendation provides mechanisms for validating distinct datum (via simple types) and the composite structure of data (via complex types). This article is an overview of complex types.

The subsequent sections of this document cover the four complex type variations:

  • Empty content—element types that optionally specify attribute types, but do not permit content.

  • Simple content—adding or removing attribute types to what would otherwise be simple types.

  • Complex content—specifying a complex, generally rigid, structure or hierarchy of element types, and their associated attribute types.

  • Mixed content—specifying a potentially complex structure in which text might be interspersed in the corresponding XML.

This article also covers extending and restricting complex types. This functionality supports an object-oriented approach to building complex types in XML Schema.

Finally, this article covers the distinction between the frequently used shorthand notation for describing complex types, and the precise longhand notation.

Due to the complexity of creating and using complex types, some of the examples might not be entirely clear without further context. An XML schema and a corresponding XML instance contain examples that demonstrate complex types in much more detail.

  • + Share This
  • 🔖 Save To Your Account