Uncalled methods in private implementations of public interfaces

package nu.xom.xslt;

/**
 * 
 * <p>
 * This is just for XSLTransform, and implements only the functionality
 * that class requires. Other classes should not use this.
 * It is far from a conformant implementation of XMLReader. 
 * </p>
 *
 */
class XOMReader implements XMLReader {

    private SAXConverter converter;
        
    public boolean getFeature(String uri) 
      throws SAXNotRecognizedException, SAXNotSupportedException {
        
        if ("http://xml.org/sax/features/namespace-prefixes".equals(uri)
          || "http://xml.org/sax/features/namespaces".equals(uri)) {
            return true;   
        }
        throw new SAXNotRecognizedException("XOMReader doesn't support features");
        
    }

    
    public void setFeature(String uri, boolean value)
      throws SAXNotRecognizedException, SAXNotSupportedException {

    }

    
    public Object getProperty(String uri) throws SAXNotRecognizedException,
            SAXNotSupportedException {
        
        if ("http://xml.org/sax/properties/lexical-handler".equals(uri)) {
            return converter.getLexicalHandler();
        }
        else {
            throw new SAXNotRecognizedException("XOMReader doesn't support features");
        }
        
    }

    
    public void setProperty(String uri, Object value)
      throws SAXNotRecognizedException, SAXNotSupportedException {

        if ("http://xml.org/sax/properties/lexical-handler".equals(uri)) {
            LexicalHandler handler = (LexicalHandler) value;
            converter.setLexicalHandler(handler);
        }
        else {
            throw new SAXNotRecognizedException(
              "XOMReader doesn't support " + uri);
        }

    }

    
    public void setEntityResolver(EntityResolver resolver) {
        throw new UnsupportedOperationException();
    }

    
    public EntityResolver getEntityResolver() {
        return null;
    }

    
    public void setDTDHandler(DTDHandler handler) {
        // throw new UnsupportedOperationException();
    }

    
    public DTDHandler getDTDHandler() {
        return null;
    }

    
    public void setContentHandler(ContentHandler handler) {
        converter = new SAXConverter(handler);
        // warn the SAXConverter that we're using this for XSLT
        converter.setContentHandler(new XSLTHandler(null));
    }

    
    public ContentHandler getContentHandler() {
        return null;
    }

    
    public void setErrorHandler(ErrorHandler handler) {
    }

    
    public ErrorHandler getErrorHandler() {
        return null;
    }

    
    public void parse(InputSource source) 
      throws IOException, SAXException {
        
        XOMInputSource xis = (XOMInputSource) source;
        converter.convert(xis.getNodes());
        
    }

    
    public void parse(String url) throws IOException, SAXException {
        throw new UnsupportedOperationException();
    }

    
}

Previous | Next | Top | Cafe con Leche

Copyright 2005 Elliotte Rusty Harold
elharo@metalab.unc.edu
Last Modified November 3, 2005