These constraints are generally expressed using some combination of grammatical rules governing the order of elements, Boolean predicates that the content must satisfy, data types governing the content of elements and attributes, and more specialized rules such as uniqueness and referential integrity constraints.
Validation of an instance document against a schema can be regarded as a conceptually separate operation from XML parsing.
Unlike W3C XML Schema, RELAX NG was designed so that validation and augmentation (adding type information and default values) are separate.
In practice it is common for a RELAX NG schema to use the predefined "simple types" and "restrictions" (pattern, maxLength, etc.)
In W3C XML Schema a specific number or range of repetitions of patterns can be expressed whereas it is practically not possible to specify at all in RELAX NG (
W3C XML Schema is complex and hard to learn, although that is partially because it tries to do more than mere validation (see PSVI).
The W3C XML Schema language, in particular, can be quite verbose, while a DTD can be terse and relatively easily editable.
Likewise, WXS's formal mechanism for associating a document with a schema can pose a potential security problem.
For WXS validators that will follow a URI to an arbitrary online location, there is the potential for reading something malicious from the other side of the stream.
[9] W3C XML Schema does not implement most of the DTD ability to provide data elements to a document.
Although W3C XML Schema's ability to add default attributes to elements is an advantage, it is a disadvantage in some ways as well.
Xerces and the .NET Framework's Base Class Library both provide support for WXS validation.
While the language of RELAX NG can be written in XML, it also has an equivalent form that is much more like a DTD, but with greater specifying power.
W3C XML Schema requires all of its sequences to be fully deterministic, so mechanisms like the above must be either specified in a different way or omitted altogether.
RELAX NG's specification only lists two built-in types (string and token), but it allows for the definition of many more.
In practice, however, most RELAX NG processors support the W3C XML Schema set of data types.
Unlike the main three, it defines an XML file's syntax as a list of XPath-based rules.
While Schematron is good at relational constructs, its ability to specify the basic structure of a document, that is, which elements can go where, results in a very verbose schema.
The typical way to solve this is to combine Schematron with RELAX NG or W3C XML Schema.
This allows Schematron rules to specify additional constraints to the structure defined by W3C XML Schema or RELAX NG.
Its sole purpose is to direct parts of documents to individual schemas based on the namespace of the encountered elements.