<simpleType>
The <simpleType> element allows you to create an element with a content model that is still simple content—that is, content that contains only data and not child elements or mixed content. However, it provides a new level of flexibility: the ability to place restrictions on the existing datatype.
Why is this useful? Well, one example might be declaring an element for inventory. Let's say that you have an inventory item, and you want to create an <inventory> element to represent that inventory. However, because you order the item by the gross, there will never be more than 144 of the item in your inventory, and there can be as few as 0 items in stock. We can use the <simpleType> to declare this kind of element:
<xs:element name="inventory"> ...
Get Special Edition Using XML, 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.