What Is an XML Schema?
An XML Schema conforms with the W3C XML Schema Recommendation. The XML Schema Recommendation defines an XML markup vocabulary for specifying the structure of an XML document. An XML Schema serves the same purpose as a DTD. The most visible difference is that an XML Schema is in XML, while a DTD is not.
Like a DTD, an XML Schema describes the structure of a document. However, an XML Schema contains more specialized types of nodes than a DTD schema. For example, in an XML Schema, you can define nodes of type
In an XML Schema, elements that contain subelements or attributes are called complexTypes. Elements that contain data but do not contain subelements or attributes are simpleTypes. Attributes are always simpleTypes. In your XML Schema, along with elements and attributes, you define complexTypes and some simpleTypes. In addition, many simpleTypes are part of the XML Schema grammar.