1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.rendering.xml.internal.parser

File AbstractParser.java

 

Coverage histogram

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

Code metrics

0
5
2
1
56
24
2
0.4
2.5
2
1

Classes

Class Line # Actions
AbstractParser 37 5 0% 2 3
0.571428657.1%
 

Contributing tests

This file is covered by 4 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.xml.internal.parser;
21   
22    import java.io.Reader;
23   
24    import org.xwiki.rendering.block.XDOM;
25    import org.xwiki.rendering.internal.parser.XDOMGeneratorListener;
26    import org.xwiki.rendering.parser.ParseException;
27    import org.xwiki.rendering.parser.Parser;
28    import org.xwiki.rendering.parser.xml.ContentHandlerBlockParser;
29    import org.xwiki.rendering.parser.xml.ContentHandlerBlockParserFactory;
30   
31    /**
32    * Base class for all XML based parsers. This support both block based and streaming renderers interfaces.
33    *
34    * @version $Id: 1e0fc395fc8e4178938df8b1b26ec4a7525b07fc $
35    * @since 5.2M1
36    */
 
37    public abstract class AbstractParser extends AbstractStreamParser implements Parser, ContentHandlerBlockParserFactory
38    {
 
39  4 toggle @Override
40    public XDOM parse(Reader source) throws ParseException
41    {
42  4 XDOMGeneratorListener listener = new XDOMGeneratorListener();
43   
44  4 parse(source, listener);
45   
46  4 return listener.getXDOM();
47    }
48   
 
49  0 toggle @Override
50    public ContentHandlerBlockParser createBlockParser()
51    {
52  0 XDOMGeneratorListener listener = new XDOMGeneratorListener();
53   
54  0 return new ProxyContentHandlerBlockParser(createParser(listener), listener);
55    }
56    }