Clover coverage report - Clover results for XOM 1.2d1
Coverage timestamp: Wed Feb 8 2006 08:31:33 EST
file stats: LOC: 156   Methods: 14
NCLOC: 78   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
XOMReader.java 16.7% 40% 50% 40%
coverage coverage
 1    /* Copyright 2004 Elliotte Rusty Harold
 2   
 3    This library is free software; you can redistribute it and/or modify
 4    it under the terms of version 2.1 of the GNU Lesser General Public
 5    License as published by the Free Software Foundation.
 6   
 7    This library is distributed in the hope that it will be useful,
 8    but WITHOUT ANY WARRANTY; without even the implied warranty of
 9    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 10    GNU Lesser General Public License for more details.
 11   
 12    You should have received a copy of the GNU Lesser General Public
 13    License along with this library; if not, write to the
 14    Free Software Foundation, Inc., 59 Temple Place, Suite 330,
 15    Boston, MA 02111-1307 USA
 16   
 17    You can contact Elliotte Rusty Harold by sending e-mail to
 18    elharo@metalab.unc.edu. Please include the word "XOM" in the
 19    subject line. The XOM home page is located at http://www.xom.nu/
 20    */
 21   
 22    package nu.xom.xslt;
 23   
 24    import java.io.IOException;
 25   
 26    import nu.xom.converters.SAXConverter;
 27   
 28    import org.xml.sax.ContentHandler;
 29    import org.xml.sax.DTDHandler;
 30    import org.xml.sax.EntityResolver;
 31    import org.xml.sax.ErrorHandler;
 32    import org.xml.sax.InputSource;
 33    import org.xml.sax.SAXException;
 34    import org.xml.sax.SAXNotRecognizedException;
 35    import org.xml.sax.SAXNotSupportedException;
 36    import org.xml.sax.XMLReader;
 37    import org.xml.sax.ext.LexicalHandler;
 38   
 39    /**
 40    *
 41    * <p>
 42    * This is just for XSLTransform, and implements only the functionality
 43    * that class requires. Other classes should not use this.
 44    * It is far from a conformant implementation of XMLReader.
 45    * </p>
 46    *
 47    * @author Elliotte Rusty Harold
 48    * @version 1.0
 49    *
 50    */
 51    class XOMReader implements XMLReader {
 52   
 53    private SAXConverter converter;
 54   
 55  0 public boolean getFeature(String uri)
 56    throws SAXNotRecognizedException, SAXNotSupportedException {
 57   
 58  0 if ("http://xml.org/sax/features/namespace-prefixes".equals(uri)
 59    || "http://xml.org/sax/features/namespaces".equals(uri)) {
 60  0 return true;
 61    }
 62  0 throw new SAXNotRecognizedException("XOMReader doesn't support features");
 63   
 64    }
 65   
 66   
 67  433 public void setFeature(String uri, boolean value)
 68    throws SAXNotRecognizedException, SAXNotSupportedException {
 69   
 70    }
 71   
 72   
 73  0 public Object getProperty(String uri) throws SAXNotRecognizedException,
 74    SAXNotSupportedException {
 75   
 76  0 if ("http://xml.org/sax/properties/lexical-handler".equals(uri)) {
 77  0 return converter.getLexicalHandler();
 78    }
 79    else {
 80  0 throw new SAXNotRecognizedException("XOMReader doesn't support features");
 81    }
 82   
 83    }
 84   
 85   
 86  433 public void setProperty(String uri, Object value)
 87    throws SAXNotRecognizedException, SAXNotSupportedException {
 88   
 89  433 if ("http://xml.org/sax/properties/lexical-handler".equals(uri)) {
 90  433 LexicalHandler handler = (LexicalHandler) value;
 91  433 converter.setLexicalHandler(handler);
 92    }
 93    else {
 94  0 throw new SAXNotRecognizedException(
 95    "XOMReader doesn't support " + uri);
 96    }
 97   
 98    }
 99   
 100   
 101  0 public void setEntityResolver(EntityResolver resolver) {
 102  0 throw new UnsupportedOperationException();
 103    }
 104   
 105   
 106  0 public EntityResolver getEntityResolver() {
 107  0 return null;
 108    }
 109   
 110   
 111  433 public void setDTDHandler(DTDHandler handler) {
 112    // throw new UnsupportedOperationException();
 113    }
 114   
 115   
 116  0 public DTDHandler getDTDHandler() {
 117  0 return null;
 118    }
 119   
 120   
 121  972 public void setContentHandler(ContentHandler handler) {
 122  972 converter = new SAXConverter(handler);
 123    // warn the SAXConverter that we're using this for XSLT
 124  972 converter.setContentHandler(new XSLTHandler(null));
 125    }
 126   
 127   
 128  0 public ContentHandler getContentHandler() {
 129  0 return null;
 130    }
 131   
 132   
 133  433 public void setErrorHandler(ErrorHandler handler) {
 134    }
 135   
 136   
 137  433 public ErrorHandler getErrorHandler() {
 138  433 return null;
 139    }
 140   
 141   
 142  972 public void parse(InputSource source)
 143    throws IOException, SAXException {
 144   
 145  972 XOMInputSource xis = (XOMInputSource) source;
 146  972 converter.convert(xis.getNodes());
 147   
 148    }
 149   
 150   
 151  0 public void parse(String url) throws IOException, SAXException {
 152  0 throw new UnsupportedOperationException();
 153    }
 154   
 155   
 156    }