Content Filters
By this point, you may have noticed a problem with the XMLFilter interface. It filters calls from the client application to the parser; however, most events are passed in the opposite direction from the parser to the client application through the various callback interfaces, particularly ContentHandler. XMLFilter is set up exactly backwards for filtering these events. It filters calls from the client application to the parser, but not the much more important calls from the parser to the client application!
It is possible to work around this. First, intercept the handlers passed to methods such as setContentHandler() and setDTDHandler(). Then, replace them with handlers of your own so that your handlers receive the callback events ...
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