1. Project Clover database Sat Feb 2 2019 06:45:20 CET
  2. Package org.xwiki.rendering.xdomxmlcurrent.internal.parser

File XDOMXMLContentHandlerStreamParser.java

 

Coverage histogram

../../../../../../img/srcFileCovDistChart6.png
72% of files have more coverage

Code metrics

0
13
13
1
136
88
13
1
1
13
1

Classes

Class Line # Actions
XDOMXMLContentHandlerStreamParser 46 13 0% 13 12
0.5384615753.8%
 

Contributing tests

This file is covered by 552 tests. .

Source view

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.xdomxmlcurrent.internal.parser;
21   
22    import javax.inject.Inject;
23    import javax.inject.Named;
24   
25    import org.xml.sax.Attributes;
26    import org.xml.sax.ContentHandler;
27    import org.xml.sax.Locator;
28    import org.xml.sax.SAXException;
29    import org.xwiki.component.annotation.Component;
30    import org.xwiki.component.annotation.InstantiationStrategy;
31    import org.xwiki.component.descriptor.ComponentInstantiationStrategy;
32    import org.xwiki.filter.xml.parser.XMLParserFactory;
33    import org.xwiki.rendering.listener.Listener;
34    import org.xwiki.rendering.parser.xml.ContentHandlerStreamParser;
35    import org.xwiki.rendering.syntax.Syntax;
36   
37    /**
38    * Generic XML based events parser.
39    *
40    * @version $Id: 6b771adac225d89f3ef5eaea754452562642346d $
41    * @since 3.3M1
42    */
43    @Component
44    @Named("xdom+xml/current")
45    @InstantiationStrategy(ComponentInstantiationStrategy.PER_LOOKUP)
 
46    public class XDOMXMLContentHandlerStreamParser implements ContentHandlerStreamParser
47    {
48    /**
49    * The actual parser factory.
50    */
51    @Inject
52    private XMLParserFactory parserFactory;
53   
54    /**
55    * The content handler to send SAX events to.
56    */
57    private ContentHandler handler;
58   
 
59  0 toggle @Override
60    public Syntax getSyntax()
61    {
62  0 return Syntax.XDOMXML_CURRENT;
63    }
64   
 
65  568 toggle @Override
66    public void setListener(Listener listener)
67    {
68  568 this.handler = this.parserFactory.createContentHandler(listener, null);
69    }
70   
 
71  13380 toggle @Override
72    public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException
73    {
74  13380 this.handler.startElement(uri, localName, qName, attributes);
75    }
76   
 
77  13380 toggle @Override
78    public void endElement(String uri, String localName, String qName) throws SAXException
79    {
80  13380 this.handler.endElement(uri, localName, qName);
81    }
82   
 
83  23198 toggle @Override
84    public void characters(char[] ch, int start, int length) throws SAXException
85    {
86  23198 this.handler.characters(ch, start, length);
87    }
88   
 
89  0 toggle @Override
90    public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException
91    {
92  0 this.handler.ignorableWhitespace(ch, start, length);
93    }
94   
 
95  0 toggle @Override
96    public void skippedEntity(String name) throws SAXException
97    {
98  0 this.handler.skippedEntity(name);
99    }
100   
 
101  568 toggle @Override
102    public void setDocumentLocator(Locator locator)
103    {
104  568 this.handler.setDocumentLocator(locator);
105    }
106   
 
107  568 toggle @Override
108    public void startDocument() throws SAXException
109    {
110  568 this.handler.startDocument();
111    }
112   
 
113  568 toggle @Override
114    public void endDocument() throws SAXException
115    {
116  568 this.handler.endDocument();
117    }
118   
 
119  0 toggle @Override
120    public void startPrefixMapping(String prefix, String uri) throws SAXException
121    {
122  0 this.handler.startPrefixMapping(prefix, uri);
123    }
124   
 
125  0 toggle @Override
126    public void endPrefixMapping(String prefix) throws SAXException
127    {
128  0 this.handler.endPrefixMapping(prefix);
129    }
130   
 
131  0 toggle @Override
132    public void processingInstruction(String target, String data) throws SAXException
133    {
134  0 this.handler.processingInstruction(target, data);
135    }
136    }