If data must be exchanged between applications, the structure of the xml file must be known in advance. The Document Type Definition (DTD) is a grammar against which an XML document is validated for accuracy and conformance.
The sample DTD :
<!ELEMENT TEAM (MEMBER+)> <!ELEMENT MEMBER (PLAYER, AGE, RUNS?,WICKETS?)> <!ELEMENT PLAYER (#PCDATA)> <!ELEMENT AGE(#PCDATA)> <!ELEMENT RUNS (#PCDATA)> <!ELEMENT WICKETS(#PCDATA)> <!ATTLIST PLAYER ROLE CDATA #IMPLIED> |
The DTD clearly lists out the structure of the document in terms of its elements and attributes. It specifies which elements (or attributes) are optional (those with an appended "?") and which aren't, and whether an element contains more elements or just text.
An XML document that conforms to a DTD is said to be valid. Validity is a sufficient condition for an XML 1.0 document, i.e. all valid XML documents are well formed (and hence conform to the W3C XML 1.0 specification), but being well formed alone does not make a document valid.
For XSD and XSL validation has other meaning. The XML Schemas will be validated against a built-in "schema-of-schema", while the stylesheet will be validated by creating a transformer based on it. If the transformer creation fails then the stylesheet is considered not valid.
Shortcut:
Press the "Validate" button - to perform this check.