Skip to Content
Special Edition Using XML, Second Edition
book

Special Edition Using XML, Second Edition

by - et al. David Gulbransen
July 2002
Intermediate to advanced
864 pages
22h 32m
English
Que
Content preview from Special Edition Using XML, Second Edition

<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"> ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

XML Pocket Reference, 3rd Edition

XML Pocket Reference, 3rd Edition

Simon St. Laurent, Michael Fitzgerald
Essential XML: Beyond Markup

Essential XML: Beyond Markup

Don Box, Aaron Skonnard, John Lam

Publisher Resources

ISBN: 078972748XPurchase book