External entity data that does not conform to the XML syntax cannot be processed by the parser, so it is not passed on to the application. The application would therefore not know of its existence. To overcome this limitation, a mechanism is provided for the parser to tell the application about any binary entity declarations it encounters, as well as any notation declarations (which the entity declarations reference).
Using this information, the application can locate the binary entities, and perhaps call other applications that can handle them on its behalf.
The DTDHandler interface is implemented by a class in the main application. The class that implements this interface must include the following methods:
void notationDecl(String name, String publicId, String systemId ) throws SAXException; void unparsedEntityDecl(String name, String publicID, String systemID, String notationName) throws SAXException;
Then an object instantiated from this class needs to be passed to the parser, in the now familiar way, this time using the setDTDHandler method. Once again, an application would typically implement this interface in the same class as the event-handler methods:
class MyClass implements DTDHandler { ... myParser.setDTDHandler(this);
Note that this interface is unchanged in SAX 2.0.
The final parameter of the unparsedEntityDecl method provides the name of a notation. The details of this notation should have already been passed to the notationDecl method.
18.227.0.192