Examples from Chapter 20 of The XML 1.1 Bible, Schemas
Listing 20-1: greeting.xsd
Listing 20-2: valid_greeting.xml
Listing 20-3: invalid_greeting.xml
Listing 20-4: yesiam.xml
Listing 20-5: song.xsd
Listing 20-6: hotcop.xml
Listing 20-7: minOccurs and maxOccurs
Listing 20-8: Taking Advantage of the Default Values of minOccurs and maxOccurs
Listing 20-9: A Deeper Hierarchy
Listing 20-10: Defining Separate ComposerType and ProducerType Types
Listing 20-11: Using a Single PersonType for Both COMPOSER and PRODUCER
Listing 20-12: Anonymous Types
Listing 20-13: Mixed Content
Listing 20-14: Declaring Mixed Content in a Schema
Listing 20-15: A Song Document That Places the Elements in a Different Order
Listing 20-16: A Schema with Simple Data Types
Listing 20-17: fixed hotcop.xml
Listing 20-18: A Schema That Derives a Str255 Data Type from xsd:string
Listing 20-19: A Schema That Suggests Collapsing White Space in Elements
Listing 20-20: A Schema That Uses an Enumeration to Derive a Type from xsd:string
Listing 20-21: A Schema That Defines a Custom Money Type
Listing 20-22: The PHOTO Element Has Several Attributes of Different Types
Listing 20-23: A SONG Schema That Declares Attributes
Listing 20-24: A SONG Document in the http://ns.cafeconleche.org/song Namespace
Listing 20-25: A Schema for SONG Documents in the http://ns.cafeconleche.org/song Namespace
Listing 20-26: A SONG Document in the http://ns.cafeconleche.org/song Namespace with Prefixes
Listing 20-27: A SONG Document That Uses XLink to Embed Photos
Listing 20-28: xlink.xsd: An XLink Schema
A SONG Schema That Imports the XLink Schema
Copyright 2004
Elliotte Rusty Harold
elharo@metalab.unc.edu
Last Modified March 1, 2004