7.4. Well-Formed XMLBrowsers often recover from sloppily written or illegal HTML. This is not the case with XML documents. Because XML languages vary, the rules for coding the document need to be followed to the letter to ensure proper interpretation by the XML client. In fact, the XML specification strictly prohibits XML parsers from trying to read or render documents with syntax errors. When a document follows the XML markup syntax rules, it is said to be well-formed . Documents that have incorrect syntax are referred to as malformed . The primary rules for a well-formed XML document are:
This is by no means a complete list. There are over a hundred criteria that must be met for a document to be well-formed, but many of them follow common sense; for example, there must be at least one character between the brackets <>. But because the syntax rules must be read by machines (without common sense), the rules need to be explicit. You can check whether the syntax of your XML document is correct using a well-formedness checker (also called a non-validating parser). There is a list of them at the Web Developer's Virtual Library at wdvl.com/Software/XML/parsers.html. |