Valid XML

When an XML document conforms to all the rules established in the DTD, it is said to be valid , meaning that all the elements are used correctly.

Tip

A well-formed document is not necessarily valid, but if a document proves to be valid, it follows that it is also well-formed.

When your document uses a DTD, you can check it for mistakes using a validating parser. The parser checks the document against the DTD for contextual errors, such as missing elements or improper order of elements. Some common parsers are Xerces from the Apache XML Project (available at http://xml.apache.org) and Microsoft MSXML (http://msdn.microsoft.com/xml/default.asp). A full list of validating parsers is provided by Web Developer’s Virtual Library at http://wdvl.com/Software/XML/parsers.html.

As an alternative to downloading your own parser, you can use a free online parsing service. Just enter the locations of your documents at these sites:

Get Web Design in a Nutshell, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.