20 The XML Files: Develo pment of XML/XSL A pplications Using WebS phere Studio
򐂰XML Schema Part 0: This is a primer, it is intended to provide an easily
readable description of the XML Schem a facilities, and is oriented towards
quickly understanding how to create schemas using the XML Schema
language.
򐂰XML Schema Part 1: Structures specify the XML Schema definition language,
which offers facilities for describing the structure and constraining the
contents of XML 1.0 documents, including those which exploit the XML
Namespace facility.
򐂰XML Schema Part 2: Datatypes 2: It defines facilities for defining datatypes to
be used in XML Schemas as well as other XML specifications.
DTDs consists of elements that text string, text string with other child elements
and a set of child elements. DTDs also offer limited support for types and
namespaces. Lastly, the syntax in DTDs is not XML.
XML Schema is more powerful than DTD. Advantages of XML Schema over
DTDs are:
򐂰Defines data types for elements and attributes, and their default and fixed
values. Some of the data types can be of string, dec imal, integer, boolean,
date, time or duration. Altogether there are 19 built-in primitive data types and
23 built-in derived data types. Primitive data types are not defined in terms of
any other data types, whereas derived data types are defined i n terms of
other data types.
򐂰Apply restrictions to elements, by stating minimum and maximum values, (for
example, on age from 1 to 90 years), or restrictions of cer tain values (eg.
redbooks, residencies, Redpieces with no other values accepted, such as in a
drop-down list box). Restrictions can also be applied to types o f characters
and their patterns (eg. only accepting values a to z and also specifying that
only three letters can be accepted). The length of the data can also be
specified. (Eg. passwords must be between 4 and 8 characters.)
򐂰Specify complex element type. Complex types may contain simple elements
and other complex types. Restrictions can be applied to the sequence and
their frequency of their occurrences. These complex types can then be used
in other complex type elements.
򐂰Since schemas are written in XML, they are also extensible. The also implies
that the learning curve for learning another languag e has been eliminated, the
available parsers need not be enhanced, transformation can be carried out
using XSLT, and also its manipulation can be carried out using XML DOM.
򐂰With XML Schemas being extensible, they can be re-used in other schemas,
we can reference multiple schemas from the same document, and also have
the ability to create our own data types from standard data types.