November 2002
Intermediate to advanced
1120 pages
21h 2m
English
SAX includes an adapter class that you can subclass to build these sorts of two-way filters: org.xml.sax.helpers.XMLFilterImpl. Its general design is similar to what I just detailed, but it implements all of the relevant interfaces in one class:
public class XMLFilterImpl implements XMLFilter, EntityResolver, DTDHandler, ContentHandler, ErrorHandler
When the various setter methods such as setContentHandler() and setErrorHandler() in this class are invoked, the handler is stored in a private field. For example, here is the setContentHandler() method:
public void setContentHandler (ContentHandler handler)
{
contentHandler = handler;
}
When the parse() method is called, it swaps out all of the installed handlers for the ...
Read now
Unlock full access