Validating xml sax
To do that, you'll use a document type definition (DTD) as you experiment with validation.
To see what happens when the XML document does not specify a DTD, remove the declaration. Because you don't yet have one, it's value is null.
For now, think of these attributes as the "magic incantation" you use to validate a simple XML file that doesn't use them.
After you've learned more about namespaces, you'll see how to use XML Schema to validate complex documents that use them.
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.We have tried the DOM interface in previous sections. Here is a tutorial example program called Xsd Schema Sax that validates an XML file against an XSD file using the SAX interface: /* * Xsd Schema Sax - Copyright (c) 2013, Herong Yang.com, All Rights Reserved. [This sample application uses a feature that was first implemented in MSXML 4.0.]This example attempts to validate an XML data file (books.xml) against an XML schema definition file (books.xsd).For an XML document to be based on an XML schema, the XML document is required to be validated with the schema.By now, you have done a lot of experimenting with the nonvalidating parser.