Clover coverage report - dom4j - 1.6.1
Coverage timestamp: ma mei 16 2005 14:23:01 GMT+01:00
file stats: LOC: 113   Methods: 10
NCLOC: 45   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
XMLResult.java - 42,9% 40% 41,7%
coverage coverage
 1    /*
 2    * Copyright 2001-2005 (C) MetaStuff, Ltd. All Rights Reserved.
 3    *
 4    * This software is open source.
 5    * See the bottom of this file for the licence.
 6    */
 7   
 8    package org.dom4j.io;
 9   
 10    import java.io.OutputStream;
 11    import java.io.UnsupportedEncodingException;
 12    import java.io.Writer;
 13   
 14    import javax.xml.transform.sax.SAXResult;
 15   
 16    import org.xml.sax.ContentHandler;
 17    import org.xml.sax.ext.LexicalHandler;
 18   
 19    /**
 20    * <p>
 21    * <code>XMLResult</code> implements a JAXP {@link SAXResult}for an output
 22    * stream with support for pretty printing and control over how the XML is
 23    * formatted.
 24    * </p>
 25    *
 26    * @author <a href="mailto:jstrachan@apache.org">James Strachan </a>
 27    * @version $Revision: 1.9 $
 28    */
 29    public class XMLResult extends SAXResult {
 30    private XMLWriter xmlWriter;
 31   
 32  0 public XMLResult() {
 33  0 this(new XMLWriter());
 34    }
 35   
 36  0 public XMLResult(Writer writer) {
 37  0 this(new XMLWriter(writer));
 38    }
 39   
 40  1 public XMLResult(Writer writer, OutputFormat format) {
 41  1 this(new XMLWriter(writer, format));
 42    }
 43   
 44  0 public XMLResult(OutputStream out) throws UnsupportedEncodingException {
 45  0 this(new XMLWriter(out));
 46    }
 47   
 48  0 public XMLResult(OutputStream out, OutputFormat format)
 49    throws UnsupportedEncodingException {
 50  0 this(new XMLWriter(out, format));
 51    }
 52   
 53  1 public XMLResult(XMLWriter xmlWriter) {
 54  1 super(xmlWriter);
 55  1 this.xmlWriter = xmlWriter;
 56  1 setLexicalHandler(xmlWriter);
 57    }
 58   
 59  0 public XMLWriter getXMLWriter() {
 60  0 return xmlWriter;
 61    }
 62   
 63  0 public void setXMLWriter(XMLWriter writer) {
 64  0 this.xmlWriter = writer;
 65  0 setHandler(xmlWriter);
 66  0 setLexicalHandler(xmlWriter);
 67    }
 68   
 69  1 public ContentHandler getHandler() {
 70  1 return xmlWriter;
 71    }
 72   
 73  1 public LexicalHandler getLexicalHandler() {
 74  1 return xmlWriter;
 75    }
 76    }
 77   
 78    /*
 79    * Redistribution and use of this software and associated documentation
 80    * ("Software"), with or without modification, are permitted provided that the
 81    * following conditions are met:
 82    *
 83    * 1. Redistributions of source code must retain copyright statements and
 84    * notices. Redistributions must also contain a copy of this document.
 85    *
 86    * 2. Redistributions in binary form must reproduce the above copyright notice,
 87    * this list of conditions and the following disclaimer in the documentation
 88    * and/or other materials provided with the distribution.
 89    *
 90    * 3. The name "DOM4J" must not be used to endorse or promote products derived
 91    * from this Software without prior written permission of MetaStuff, Ltd. For
 92    * written permission, please contact dom4j-info@metastuff.com.
 93    *
 94    * 4. Products derived from this Software may not be called "DOM4J" nor may
 95    * "DOM4J" appear in their names without prior written permission of MetaStuff,
 96    * Ltd. DOM4J is a registered trademark of MetaStuff, Ltd.
 97    *
 98    * 5. Due credit should be given to the DOM4J Project - http://www.dom4j.org
 99    *
 100    * THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. AND CONTRIBUTORS ``AS IS'' AND
 101    * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 102    * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 103    * ARE DISCLAIMED. IN NO EVENT SHALL METASTUFF, LTD. OR ITS CONTRIBUTORS BE
 104    * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 105    * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 106    * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 107    * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 108    * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 109    * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 110    * POSSIBILITY OF SUCH DAMAGE.
 111    *
 112    * Copyright 2001-2005 (C) MetaStuff, Ltd. All Rights Reserved.
 113    */