Well-formed and valid XML Documents
What is a well-formed XML Document?
A well-formed XML Document has to follow several generic rules, such as:
 |
| • | The XML Document may only have one root element (<book>...</book>). |
| • | All tags have an ending tag or are themselves self-ending (<author>...</author> or <author/>). |
| • | Tags never overlap, so this arrangement would produce an error: <author><name>...</author></name>. |
It is important to make an XML Document well-formed. In fact, W3C doesn't consider an XML document to be XML unless it is well-formed. If the XML Document contains a reference to a schema (e.g., a DTD, Relax NG Schema or an XML Schema), it's better to validate the XML Document.
How to check the well-formedness of an XML Document
XMLBlueprint can check the well-formedness of any DTD, Relax NG Schema, XML Schema or XML Document:
Open your file in the XML Editor.
Click XML > Check Well-formedness.
The Output Window is automatically displayed to show any errors in the file. Click on the error message to jump to the position where the error occurred.
What is valid XML Document?
A valid XML document, in addition to being well-formed, conforms to all the constraints imposed by a schema (e.g., a DTD, Relax NG Schema or an XML Schema). In other words, it does not contain any tags that are not permitted by the schema, and the order of the tags conforms to the schema's specifications.
How to validate an XML Document
XMLBlueprint can validate any XML Document against a DTD, Relax NG Schema or XML Schema:
Open your XML Document in the XML Editor.
Click XML > Validate.
The Output Window is automatically displayed to show any errors in the XML Document. Click on the error message to jump to the position where the error occurred.
See Also