Introduction to XML Schema
XML Schema is an alternative to DTD based on XML.
XML Schema can describe the structure of an XML document.
The XML Schema language is also referred to as XSD (XML Schema Definition).
Prerequisites
Before proceeding, you should have a basic understanding of the following:
- HTML / XHTML
- XML and XML Namespaces
- Basic knowledge of DTD
If you wish to learn these topics first, please visit these tutorials on our homepage.
What is XML Schema?
The purpose of XML Schema is to define the legal building blocks of an XML document, similar to DTD.
XML Schema:
- Defines the elements that can appear in the document
- Defines the attributes that can appear in the document
- Defines which elements are child elements
- Defines the order of the child elements
- Defines the number of child elements
- Defines whether an element is empty or can contain text
- Defines the data types of elements and attributes
- Defines default and fixed values for elements and attributes
XML Schema as the Successor to DTD
We believe that XML Schema will soon replace DTD in most web applications.
Reasons include:
- XML Schema can be extended for future needs
- XML Schema is more comprehensive and powerful
- XML Schema is written in XML
- XML Schema supports data types
- XML Schema supports namespaces
XML Schema as a W3C Standard
XML Schema became a W3C standard on May 2, 2001.
You can find more information about the XML Schema standard in our W3C tutorial.