Coverage Report - net.sf.practicalxml.util.XMLFilterImplBridge
 
Classes in this File Line Coverage Branch Coverage Complexity
XMLFilterImplBridge
41%
15/36
N/A
1
 
 1  
 // Copyright 2008-2014 severally by the contributors
 2  
 //
 3  
 // Licensed under the Apache License, Version 2.0 (the "License");
 4  
 // you may not use this file except in compliance with the License.
 5  
 // You may obtain a copy of the License at
 6  
 //
 7  
 //     http://www.apache.org/licenses/LICENSE-2.0
 8  
 //
 9  
 // Unless required by applicable law or agreed to in writing, software
 10  
 // distributed under the License is distributed on an "AS IS" BASIS,
 11  
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12  
 // See the License for the specific language governing permissions and
 13  
 // limitations under the License.
 14  
 
 15  
 package net.sf.practicalxml.util;
 16  
 
 17  
 import java.io.IOException;
 18  
 
 19  
 import org.xml.sax.Attributes;
 20  
 import org.xml.sax.InputSource;
 21  
 import org.xml.sax.Locator;
 22  
 import org.xml.sax.SAXException;
 23  
 import org.xml.sax.SAXParseException;
 24  
 import org.xml.sax.helpers.DefaultHandler;
 25  
 import org.xml.sax.helpers.XMLFilterImpl;
 26  
 
 27  
 
 28  
 /**
 29  
  *  This class acts as a bridge between the <code>DefaultHandler</code>
 30  
  *  expected by <code>SAXParser</code>, and the <code>XMLReader</code>
 31  
  *  used by <code>SAXSource</code>. The latter is normally implemented
 32  
  *  using {@link org.xml.sax.helpers.XMLFilterImpl}, and this class is
 33  
  *  a wrapper for that class that simply passes all events.
 34  
  *  <p>
 35  
  *  For example usage, see {@link SimpleXMLReader}.
 36  
  *
 37  
  *  @since 1.1.1
 38  
  */
 39  
 public class XMLFilterImplBridge
 40  
 extends DefaultHandler
 41  
 {
 42  
     private XMLFilterImpl _filter;
 43  
 
 44  
     public XMLFilterImplBridge(XMLFilterImpl filter)
 45  1
     {
 46  1
         _filter = filter;
 47  1
     }
 48  
 
 49  
     @Override
 50  
     public void characters(char[] ch, int start, int length)
 51  
     throws SAXException
 52  
     {
 53  1
         _filter.characters(ch, start, length);
 54  1
     }
 55  
 
 56  
     @Override
 57  
     public void endDocument()
 58  
     throws SAXException
 59  
     {
 60  1
         _filter.endDocument();
 61  1
     }
 62  
 
 63  
     @Override
 64  
     public void endElement(String uri, String localName, String name)
 65  
     throws SAXException
 66  
     {
 67  2
         _filter.endElement(uri, localName, name);
 68  2
     }
 69  
 
 70  
     @Override
 71  
     public void endPrefixMapping(String prefix)
 72  
     throws SAXException
 73  
     {
 74  0
         _filter.endPrefixMapping(prefix);
 75  0
     }
 76  
 
 77  
     @Override
 78  
     public void error(SAXParseException e)
 79  
     throws SAXException
 80  
     {
 81  0
         _filter.error(e);
 82  0
     }
 83  
 
 84  
     @Override
 85  
     public void fatalError(SAXParseException e)
 86  
     throws SAXException
 87  
     {
 88  0
         _filter.fatalError(e);
 89  0
     }
 90  
 
 91  
     @Override
 92  
     public void ignorableWhitespace(char[] ch, int start, int length)
 93  
     throws SAXException
 94  
     {
 95  0
         _filter.ignorableWhitespace(ch, start, length);
 96  0
     }
 97  
 
 98  
     @Override
 99  
     public void notationDecl(String name, String publicId, String systemId)
 100  
     throws SAXException
 101  
     {
 102  0
         _filter.notationDecl(name, publicId, systemId);
 103  0
     }
 104  
 
 105  
     @Override
 106  
     public void processingInstruction(String target, String data)
 107  
     throws SAXException
 108  
     {
 109  0
         _filter.processingInstruction(target, data);
 110  0
     }
 111  
 
 112  
     @Override
 113  
     public InputSource resolveEntity(String publicId, String systemId)
 114  
     throws IOException, SAXException
 115  
     {
 116  0
         return _filter.resolveEntity(publicId, systemId);
 117  
     }
 118  
 
 119  
     @Override
 120  
     public void setDocumentLocator(Locator locator)
 121  
     {
 122  1
         _filter.setDocumentLocator(locator);
 123  1
     }
 124  
 
 125  
     @Override
 126  
     public void skippedEntity(String name)
 127  
     throws SAXException
 128  
     {
 129  0
         _filter.skippedEntity(name);
 130  0
     }
 131  
 
 132  
     @Override
 133  
     public void startDocument()
 134  
     throws SAXException
 135  
     {
 136  1
         _filter.startDocument();
 137  1
     }
 138  
 
 139  
     @Override
 140  
     public void startElement(String uri, String localName, String name, Attributes attributes)
 141  
     throws SAXException
 142  
     {
 143  2
         _filter.startElement(uri, localName, name, attributes);
 144  2
     }
 145  
 
 146  
     @Override
 147  
     public void startPrefixMapping(String prefix, String uri)
 148  
     throws SAXException
 149  
     {
 150  0
         _filter.startPrefixMapping(prefix, uri);
 151  0
     }
 152  
 
 153  
     @Override
 154  
     public void unparsedEntityDecl(String name, String publicId, String systemId, String notationName)
 155  
     throws SAXException
 156  
     {
 157  0
         _filter.unparsedEntityDecl(name, publicId, systemId, notationName);
 158  0
     }
 159  
 
 160  
     @Override
 161  
     public void warning(SAXParseException e)
 162  
     throws SAXException
 163  
     {
 164  0
         _filter.warning(e);
 165  0
     }
 166  
 }