- Well-Formed XML Documents
- XML Names
- Other Characteristics of Well-Formedness
- Well-Formedness and XML Processor Type
Well-Formedness and XML Processor Type
XML processors can be viewed as being of two types, validating processors and nonvalidating processors. Validation is discussed further in Chapter 4.
Both validating processors and nonvalidating processors detect any well-formedness errors in the document entity, including the internal subset of the DTD. However, their behavior might differ with external entities and the external subset of the DTD.
A validating processor must process the XML document entity, any external entities, and the DTD (both internal subset and external subset). It must access those fully to validate the XML document. In doing so, it detects any well-formedness errors in any physical part of an XML document.
Nonvalidating processors, on the other hand, need not access an external subset of the DTD (if it exists) or external entities. So, well-formedness errors might not be detected by nonvalidating processors if the well-formedness errors occur outside the document entity itself.
Another potential source of confusion with nonvalidating processors is that although they are not obliged to access parts of the document other than the document entity, nothing in the XML specification prevents them doing so. Therefore, one nonvalidating processor might detect errors that another nonvalidating processor misses because the former processor accessed external entities that the latter ignored. This could be confusing if you find no errors in your code but a recipient of a document that you have written finds errors. The recipient might simply be using a nonvalidating processor that checks more parts of the document than the nonvalidating processor that you used to run the code.