Workshops --> XML --> Demo --> schema.html
SLIS@IU logo

L595 XML@IU logo

Creating Schemas

XML Schemas are an alternative to DTDs

They are a recommendation at the W3C:

"XML Schemas express shared vocabularies and allow machines to carry out rules made by people.

They provide a means for defining the structure, content and semantics of XML documents"

Schemas can be used to

Specify the elements that a XML file can contain

Elements that contain only text are described in schema with simple types

Elements that contain other elements and/or attributes and text are described in schema with complex types

Determine the type of data that an element can contain

This is done with datatypes, which can specify that the element contain strings, numbers, text, times, dates etc.

In comparison, DTDs use a very different and more inflexible syntax than is used in an XML schema

Determine the order of the elements in the XML file

Schemas also offer local as well as global specification of elements

This provides much greater flexibility than is possible in a DTD

Global means that the element has a unique name, is defined once, and must be used the same way everywhere in the schema and XML document

The element will have the same meaning in each instance of its use

Local means that the meaning of the element depends on its context

An element with the same name can have different meanings when used in different contexts

What does a schema look like?

Home
schema schema 2 schema 3 schema 4 schema 5 schema 6 schema 7 schema 8 schema 9
Next

schema 10 schema 11 schema 12 schema 13 schema 14 schema 15 schema 16 schema 17

Page by Howard Rosenbaum
Find me at hrosenba@indiana.edu You are here: http://www.slis.indiana.edu/hrosenba/www/Workshops/XML/Demo/schema.html