The W3C XML Schema Specification in Context
This article gives simple comparisons between the W3C XML Schemas and
- W3C XML instances
- W3C XML DTDs
- ISO SGML DTDs
- ISO SGML meta-DTDs
- Perl regular expressions
And some technologies that have arisen as a response to it:
- JIS RELAX
- Schematron
- DSD
It does not provide an exhaustive list of all W3C XML Schemas features. The information was prepared with the October Candidate Recommendation versions in mind.
W3C XML Schemas operates on the Information Set of a Document
W3C XML Schemas does not operate on marked-up instances per se, but on the information set of a document after it has been parsed, after any entity expansion and attribute value defaulting has occurred. Think of it as if it were a process looking at the W3C DOM API. The result of schema-validating a document is
- a set of outcomes giving, in particular, any violations of constraints -- there is currently no standard API for this; however the W3C XML Schemas specification gives a complete list of the constraint violations;
- an enhanced information set, the post-schema-validation information set, which can include various details about type and facets -- there is currently no standard API for this either; however, the W3C XML Schemas specification gives a complete list of the additional information.
| XML Instance Markup | XML Schema | Comments |
|---|---|---|
|
Element |
W3C XML Schemas can constrain which elements are allowed in a particular context. |
Actually, W3C XML Schemas constrain the types allowed in a particular complex type. W3C XML Schemas provides many ways in which this can done, and one of the most useful acts through specifying which elements an element can constrain. |
|
Attribute |
W3C XML Schemas can constrain which attributes are allowed in a particular context. |
|
|
xml:lang global attribute |
No specific support. |
A special datatype for language is available. However, there is no facility for global declarations. The schema for schemas gives an example of how to include the declarations for the xml: namespace. |
|
xml:space Global Attribute |
No specific support |
There is no facility for global declarations. The primitive datatype "string" has a facet "whitespace" that can be used to set various stripping and folding behaviors. The schema for schemasgives an example of how to include the declarations for the xml: namespace. |
|
Attribute Value |
W3C XML Schemas can constrain the attribute values allowed in a particular context. The context is based on the current type and its ancestor types. |
|
|
Data Content |
W3C XML Schemas can constrain the attribute values allowed in a particular context. The context is based on the current type and its ancestor types. |
|
|
CDATA Sections |
No specific support. |
This is a parser function |
|
Comments |
No support |
|
|
Processing Instructions |
No support |
|
|
Entity References |
No support |
|
|
Character Reference |
No support. |
This is a parser function |
|
XML Header |
No effect |
The standalone and encoding declarations are not part of the core information set of an entity, consequently there is no support for constraining them in W3C XML Schemas. |
|
Namespace Declarations |
No support |
W3C XML Schemas is highly aware of namespaces. It does not support altering namespace information of an instance. |