Code example for XMLReader

Methods: getFeature, setContentHandler, setErrorHandler

0
     * Internally sets up the XMLReader 
     */ 
    private void setParser(XMLReader parser) {
        m_parser = parser;
        m_handler = getHandler();
        m_parser.setContentHandler(m_handler);
        m_parser.setErrorHandler(m_handler);
    } 
 
    /** 
     * Get a SAXConfigurationHandler for your configuration reading. 
     */ 
    protected SAXConfigurationHandler getHandler() { 
        try { 
            if (m_parser.getFeature("http://xml.org/sax/features/namespaces")) {
                return new NamespacedSAXConfigurationHandler(); 
            } 
        } catch (Exception e) {
            // ignore error and fall through to the non-namespaced version 
        } 
        return new SAXConfigurationHandler();