Chapter 11. Defining Complex Types

In the previous chapter, I discussed that simple type XML elements can only contain a value and not child elements or attributes. In this chapter, I will discuss complex type elements. A complex type element is one that can contain child elements, attributes, or some combination of the two.

There has been some discussion in the XML community about the intricacies of complex types, specifically, how difficult they are to understand. Even still, since you’ll want your XML document to contain more than just a root element, you’ll at least need one complex type element to allow the root element to have a child element of its own. Another important reason to use complex types in your XML Schema is to allow elements ...

Get XML: Visual QuickStart Guide, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.