Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

XML DTD

XML Validation


XML with correct syntax is called "well-formed" XML.

XML validated against a DTD is "valid" XML.


Well-Formed XML Documents

A "well-formed" XML document has correct syntax.

The syntax rules described in the previous chapters:

Tove

Jani

Reminder

Don't forget me this weekend!

Validating XML Documents

A valid XML document is a "well-formed" XML document that also conforms to the rules of a Document Type Definition (DTD):

Tove

Jani

Reminder

Don't forget me this weekend!

In the example above, the DOCTYPE declaration is a reference to an external DTD file. The following section shows the content of this file.


XML DTD

The purpose of a DTD is to define the structure of an XML document. It uses a series of legal elements to define the document structure:

]>

If you want to learn DTD, please refer to ourHomeDTD tutorial.


XML Schema

The W3C supports an XML-based alternative to DTD, named XML Schema:

xs:complexType

xs:sequence

If you want to learn about XML Schema, please refer to ourHomeSchema tutorial.


A Universal XML Validator

To help you check the syntax of XML files, we have created an XML validator so that you can perform syntax checks on any XML file.

See the next chapter.