How do you parse/validate the XML document?- Parsing the XML document is the only way to validate the XML file. - Validation is done by either DOM parser or the SAX parser. - There are multiple schema-definition languages, including RELAX NG, Schematron, and the W3C "XML Schema" standard. (Even a DTD qualifies as a "schema," although it is the only one that does not use XML syntax to describe schema constraints.) - However, "XML Schema" presents us with a terminology challenge. Although the phrase "XML Schema schema" would be precise, we will use the phrase "XML Schema definition" to avoid the appearance of redundancy. - To be notified of validation errors in an XML document, the parser factory must be configured to create a validating parser, as shown in the preceding section. In addition, the following must be true:
1. The appropriate properties must be set on the SAX parser. 2. The appropriate error handler must be set. 3. The document must be associated with a schema.
|