Examples from Chapter 23 of The XML Bible, Gold Edition: Schemas
Listing 23-1: greeting.xsd
Listing 23-2: valid_greeting.xml
Listing 23-3: invalid_greeting.xml
Listing 23-4: yesiam.xml
Listing 23-5: song.xsd
Listing 23-6: hotcop.xml
Listing 23-7: minOccurs and maxOccurs
Listing 23-8: Taking advantage of the default values of minOccurs and maxOccurs
Listing 23-9: A deeper hierarchy
Listing 23-10: Defining separate ComposerType and ProducerType types
Listing 23-11: Using a single PersonType for both COMPOSER and PRODUCER
Listing 23-12: Anonymous types
Listing 23-13: Mixed content
Listing 23-14: Declaring mixed content in a schema
Listing 23-15: A song document that places the elements in a different order
Listing 23-16: A schema with simple data types
Listing 23-17: fixed hotcop.xml
Listing 23-18: A schema that derives a Str255 data type from xsd:string
Listing 23-19: A schema that suggests collapsing white space in elements
Listing 23-20: A schema that uses an enumeration to derive a type from xsd:string
Listing 23-20: A schema that defines a custom money type
Listing 23-22: The PHOTO element has several attributes of different types
Listing 23-23: A SONG schema that declares attributes
Listing 23-24: A SONG document in the http://ibiblio.org/xml/namespace/song namespace
Listing 23-25: A schema for SONG documents in the http://ibiblio.org/xml/namespace/song namespace
Listing 23-26: A SONG document in the http://ibiblio.org/xml/namespace/song namespace with prefixes
Listing 23-27: A SONG document that uses XLink to embed photos
Listing 23-28: xlink.xsd: An XLink schema
Listing 23-29: A SONG schema that imports the XLink schema
Copyright 2001
Elliotte Rusty Harold
elharo@metalab.unc.edu
Last Modified August 14, 2001