On the other hand, if you are writing an application that filters an XML data file and if you want to output an equally readable version of the file, then that white space would no longer be irrelevant: it would be essential.To get those characters, you would add the This code simply generates a message to let you know that ignorable white space was seen. The SAX specification does not require that this method be invoked.
Application output will look like below snap: package com.g2.
XML validation is the cornerstone of good document authoring.
XML Schema (XSD) Validation using SAXParser This section describes a tutorial example on how to the Xerces2 SAXParser class to validate an XML document assigned with an XSD file.
Note that tutorial examples given in this section were taken in 2002 using JDK 1.4 and Xerces-J 2.3.
Create an XSDBuilder object and invoke the build(Input Source) method of the XSDBuilder object to obtain an XMLSchema object.
The Input Source object is created with an Input Stream object created from the example XML schema document,
You have to parse an XML document and add an Error Handler to discover whether the XML is valid or invalid.
So, even though the SAXParser itself tells you it's validating, it actually isn't, it's only the Content Handler/Error Handler that makes the difference.
A DTD or an XML Schema plus a validating parser make a document usable across applications.