code: public void setXMLReader(XMLReader eventsource)
    {
      fXMLReader=eventsource;
      eventsource.setContentHandler(this);
      eventsource.setDTDHandler(this);
      eventsource.setErrorHandler(this); // to report fatal errors in filtering mode
  
      // Not supported by all SAX2 filters:
      try 
      {
        eventsource.
          setProperty("http://xml.org/sax/properties/lexical-handler",
                      this);
      }
      catch(SAXNotRecognizedException e)
      {
        // Nothing we can do about it
      }
      catch(SAXNotSupportedException e)
      {
        // Nothing we can do about it
      }
  
      // Should we also bind as other varieties of handler?
      // (DTDHandler and so on)
    }
docs: Bind our input streams to an XMLReader.
  
  Just a convenience routine; obviously you can explicitly register
  this as a listener with the same effect.