Clover Coverage Report - XWiki Rendering - Parent POM 4.0-SNAPSHOT (Aggregated)
Coverage timestamp: Mon Mar 12 2012 18:03:13 CET
../../../../../../img/srcFileCovDistChart9.png 55% of files have more coverage
18   129   16   1.8
12   78   0.89   10
10     1.6  
1    
 
  DTDXMLFilter       Line # 32 18 0% 16 7 82.5% 0.825
 
  (219)
 
1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package org.xwiki.rendering.wikimodel.xhtml.filter;
21   
22    import org.xml.sax.Attributes;
23    import org.xml.sax.SAXException;
24    import org.xml.sax.XMLReader;
25   
26    /**
27    * Skip all callbacks when parsing the DTD.
28    *
29    * @version $Id: 702d75e4187f45b19301381a846304a8704d5135 $
30    * @since 4.0M1
31    */
 
32    public class DTDXMLFilter extends DefaultXMLFilter
33    {
34    /**
35    * We want to accumulate characters only when not parsing the DTD.
36    */
37    private boolean fIsInDTD;
38   
 
39  0 toggle public DTDXMLFilter()
40    {
41  0 super();
42    }
43   
 
44  309 toggle public DTDXMLFilter(XMLReader reader)
45    {
46  309 super(reader);
47    }
48   
49    /**
50    * @see org.xml.sax.helpers.DefaultHandler#characters(char[], int, int)
51    */
 
52  938 toggle @Override
53    public void characters(char[] array, int start, int length)
54    throws SAXException
55    {
56  938 if (!fIsInDTD) {
57  938 super.characters(array, start, length);
58    }
59    }
60   
61    /**
62    * @see org.xml.sax.helpers.DefaultHandler#startElement(java.lang.String,
63    * java.lang.String, java.lang.String, org.xml.sax.Attributes)
64    */
 
65  1677 toggle @Override
66    public void startElement(
67    String uri,
68    String localName,
69    String qName,
70    Attributes attributes) throws SAXException
71    {
72  1677 if (!fIsInDTD) {
73  1677 super.startElement(uri, localName, qName, attributes);
74    }
75    }
76   
77    /**
78    * @see org.xml.sax.helpers.DefaultHandler#endElement(java.lang.String,
79    * java.lang.String, java.lang.String)
80    */
 
81  1677 toggle @Override
82    public void endElement(String uri, String localName, String qName)
83    throws SAXException
84    {
85  1677 if (!fIsInDTD) {
86  1677 super.endElement(uri, localName, qName);
87    }
88    }
89   
 
90  91309 toggle @Override
91    public void comment(char[] array, int start, int length)
92    throws SAXException
93    {
94  91309 if (!fIsInDTD) {
95  205 super.comment(array, start, length);
96    }
97    }
98   
 
99  3 toggle @Override
100    public void startCDATA() throws SAXException
101    {
102  3 if (!fIsInDTD) {
103  3 super.startCDATA();
104    }
105    }
106   
 
107  3 toggle @Override
108    public void endCDATA() throws SAXException
109    {
110  3 if (!fIsInDTD) {
111  3 super.endCDATA();
112    }
113    }
114   
 
115  219 toggle @Override
116    public void startDTD(String name, String publicId, String systemId)
117    throws SAXException
118    {
119  219 fIsInDTD = true;
120  219 super.startDTD(name, publicId, systemId);
121    }
122   
 
123  219 toggle @Override
124    public void endDTD() throws SAXException
125    {
126  219 fIsInDTD = false;
127  219 super.endDTD();
128    }
129    }