Computers, Technology and Information Systems


XML - eXtensible Markup Language - COIN 78


The first PowerPoint presentation may serve as a general overview of XML schema, with the second adding more detail. SchemaXML99 is a broad and detailed overview, XSDL is a "whirlwind tour" of the eXtensible Schema Definition Language.

Schemas - Using Schemas in XML

Address Book Schema - Building a schema for the address book.

Tutorial files from W3C on Schema Documents:

Example files - Take a look through these example files. You can copy and paste sections for your final project.


Part 3: XML Schema and Namespaces

Note that the examples in these chapters are almost all based on the end_species.xsd and end_species.xml files, with minor changes, according to the topic in question. More importantly, I have gone to the trouble (over two excruciating months) to flesh out the examples so that you can really play around with them, send them to XSV for validation and see how they work. Please do copy them to your own site, and then test them and retest them and analyze them. Pay special attention to the comments within the documents, in which I explain which parts are in question and what is going on with them. I hope you find them useful. Let me know.

Chapter 5, XML Schema

The files in this section are in the schemas folder.

Page Section Code
72 Beginning a Simple Schema begin.xsd
73 Indicating a Simple Schema's Location location.xml
74 Annotating Schemas annotation.xsd

Chapter 6, Defining Simple Types

The files in this section are in the schemas_simple folder.

Page Section Code
76-77 Declaring an Element with a Simple Type

Figure 6.1: simpletype.xsd
Figure 6.2: simpletype1.xml
Figure 6.3: simpletype2.xml

Figure 6.4:simpletype_date.xsd
Figure 6.5: simpletype_date.xml
Figure 6.6: simpletype_date2.xml

78-79 Using Date and Time Types

Figure 6.7: timeDuration.xsd, timeDuration.xml

Figure 6.8: time.xsd, time.xml

Figure 6.9: timeInstant.xsd, timeInstant.xml

Figure 6.10: date.xsd, date.xml

Figure 6.11: month.xsd, month.xml

Figure 6.12: year.xsd, year.xml

Figure 6.13: century.xsd, century.xml

Figure 6.14: recurringDate.xsd, recurringDate.xml

Figure 6.15: recurringDay.xsd, recurringDay.xml

80 Using Number Types numbers.xsd
Figure 6.17: numbers.xml
Figure 6.18: numbers2.xml
81 Deriving Custom Simple Types custom_simple.xsd, custom_simple.xml
82 Using Anonymous Custom Types anonymous_simple.xsd, anonymous_simple.xml
83 Specifying a Set of Acceptable Values enumeration.xsd, enumeration.xml
84-85 Specifying a Pattern for a Simple Type

Figure 6.27: pattern.xsd
Figure 6.28: pattern.xml

Figure 6.29: timeDuration_andpattern.xsd
Figure 6.30: timeDuration_andpattern.xml

Figure 6.31: pattern_choices.xsd
Figure 6.32: pattern_choices.xml

86-87 Specifying a Range of Acceptable Values

Figure 6.33: maxInclusive.xsd
Figure 6.34: maxInclusive.xml

Figure 6.35: maxExclusive.xsd
Figure 6.36: maxExclusive.xml

Figure 6.37: minInclusive.xsd
Figure 6.38: minInclusive.xml, minInclusive2.xml

Figure 6.39: minExclusive.xsd
Figure 6.40: minExclusive.xml, minExclusive2.xml

88 Limiting the Length of a Simple Type

Figures 6:41 and 6:42: length.xsd, length.xml

Figure 6:43: maxLength.xsd
Figure 6.44: maxLength.xml
Figure 6.45: maxLength2.xml

89 Limiting a Number's Digits

precision_scale.xsd
Figure 6.47: precision_scale.xml, precision_scale2.xml
Figure 6.48: precision_scale3.xml, precision_scale4.xml

90 Creating List Types

Figures 6.49 and 6.50: list.xsd, list.xml

Figures 6.51 and 6.52: list_length.xsd, list_length.xml

91 Predefining an Element's Content

Figure 6.53: fixed.xsd
Figures 6.54 and 6.55: fixed.xml, fixed2.xml

Figure 6.56: default.xsd
Figures 6.57 and 6.58: default.xml, default2.xml

Chapter 7, Defining Complex Types

The files in this section are in the schemas_complex folder.

Page Section Code
94 Defining Elements to Contain Only Elements onlyelements.xsd (onlyelements.xml)
95 Requiring Elements to Appear in Sequence sequence.xsd (sequence.xml)
96 Creating a Set of Choices choice.xsd
Figure 7.8: top: choice.xml
bottom: choice2.xml
97 Allowing Elements to Appear in Any Order all.xsd, all.xml
98 Defining Named Groups group.xsd
99 Referencing a Named Group group.xml
100 Referencing Already Defined Elements referencing.xsd (referencing.xml)
101 Controlling How Many

howmany.xsd, howmany.xml

Figure 7.18: howmany2.xsd (howmany2.xml)

102 Defining Elements to Contain Only Text

Figures 7.19 and 7.20: textonly.xsd
Figure 7.21: textonly.xml
Figure 7.22: textonly2.xml

103 Defining Empty Elements Figures 7.23 and 7.24: empty.xsd
Figure 7.25: empty.xml
104 Defining Elements with Mixed Content Figures 7.26 and 7.27: mixed.xsd
Figure 7.28: mixed.xml
105 Basing Complex Types on Complex Types Figures 7.29, 7.30, 7.31: basing.xsd
Figure 7.32: basing.xml
106 Declaring an Element of Complex Type

Figure 7.33: basing.xsd

Figure 7.34: declaring.xsd (declaring.xml)
Figure 7.35: declaring2.xsd (declaring2.xml)

107 Elements with Anonymous Complex Types

Figure 7.36: anonymous.xsd
Figure 7.37: anonymous.xml

108 Declaring Attributes attributes.xsd, attributes.xml
109 Requiring an Attribute

Figure 7.40: required.xsd

Figure 7.41: top: required.xml; bottom: required2.xml

required3.xml (an invalid instance, not shown in the book)

110 Predefining an Attribute's Content

Figure 7.42: fixed.xsd
Figure 7.43: fixed.xml
Figure 7.44: fixed2.xml

Figure 7.44: default.xsd
Figure 7.45: default.xml
Figure 7.46: default2.xml

111 Defining Attribute Groups attgroups.xsd
112 Referencing Attribute Groups

attgroups.xsd, attgroups.xml

 


Click here to return to the course outline.

Last revision September 10, 2001

http://www.informaticus.org/COIN78/week6/index.htm