Called by the parser to give the application a locator for locating the origin of document events.
SAX parsers are strongly encouraged (though not absolutely required) to supply a locator: if it does so, it must supply the locator to the application by invoking this method before invoking any of the other methods in the Document Handler interface.
This will help you to get the basic concepts in parsing and how does DOM API differ from SAX.
There are three levels of errors available: warnings, (possibly) recoverable errors, and unrecoverable errors.
All methods take a Called when the parser encounters a recoverable error.
SAX parsers may return all contiguous whitespace in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity, so that the Locator provides useful information. The Parser will invoke this method once for each processing instruction found: note that processing instructions may occur before or after the main document element.
A SAX parser should never report an XML declaration (XML 1.0, section 2.8) or a text declaration (XML 1.0, section 4.3.1) using this method. The Parser will invoke this method once for each entity skipped.
To convert old code to the new interface, use Receive notification of ignorable whitespace in element content.
Validating Parsers must use this method to report each chunk of ignorable whitespace (see the W3C XML 1.0 recommendation, section 2.10): non-validating parsers may also use this method if they are capable of parsing and using content models.Handler implementations should inherit from the base classes provided in the module Basic interface for resolving entities.If you create an object implementing this interface, then register the object with your Parser, the parser will call the method in your object to resolve all external entities.The locator allows the application to determine the end position of any document-related event, even if the parser is not reporting an error.Typically, the application will use this information for reporting its own errors (such as character content that does not match an application’s business rules).Raising an exception in this method will cause parsing to end.