10.4. The HandlerBase Class
Four of the seven SAX interfaces are concerned with document handling:
DocumentHandler
ErrorHandler
DTDHandler
EntityResolver
We will take a close look at the first two of these later on. Together, these four interfaces comprise 14 different methods for handling aspects of document processing. The HandlerBase class implements default methods for all four interfaces. That is, all 14 methods required by the interfaces are defined, but they do not do anything.
Why is this useful? It is useful because it makes writing SAX applications very easy—simply make your class inherit from HandlerBase and you have implemented all four interfaces. You can simply override the methods that you actually need rather than provide stub implementions ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access