Clover Coverage Report
Coverage timestamp: Fri May 24 2013 13:47:27 UTC
../../../../../../img/srcFileCovDistChart8.png 62% of files have more coverage
16   97   12   2.67
12   45   0.75   6
6     2  
1    
 
  LatexHandler       Line # 30 16 12 79.4% 0.7941176
 
  (68)
 
1    /* This file is part of the project "Hilbert II" - http://www.qedeq.org
2    *
3    * Copyright 2000-2013, Michael Meyling <mime@qedeq.org>.
4    *
5    * "Hilbert II" is free software; you can redistribute
6    * it and/or modify it under the terms of the GNU General Public
7    * License as published by the Free Software Foundation; either
8    * version 2 of the License, or (at your option) any later version.
9    *
10    * This program 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
13    * GNU General Public License for more details.
14    */
15   
16    package org.qedeq.kernel.xml.handler.module;
17   
18    import org.qedeq.kernel.se.dto.module.LatexVo;
19    import org.qedeq.kernel.xml.common.XmlSyntaxException;
20    import org.qedeq.kernel.xml.handler.common.AbstractSimpleHandler;
21    import org.qedeq.kernel.xml.handler.common.SimpleAttributes;
22   
23   
24    /**
25    * Parse header informations.
26    *
27    * @version $Revision: 1.1 $
28    * @author Michael Meyling
29    */
 
30    public class LatexHandler extends AbstractSimpleHandler {
31   
32    /** Text language. */
33    private String language;
34   
35    /** LaTeX text. */
36    private LatexVo latex;
37   
38    /** Character data. */
39    private String data;
40   
41   
42    /**
43    * Handles LaTeX tags.
44    *
45    * @param handler Handler that uses this handler.
46    * @param startTag This is the starting tag.
47    */
 
48  614 toggle public LatexHandler(final AbstractSimpleHandler handler, final String startTag) {
49  614 super(handler, startTag);
50    }
51   
 
52  595 toggle public final void init() {
53  595 latex = null;
54    }
55   
56    /**
57    * Get parsed result.
58    *
59    * @return LaTeX text part.
60    */
 
61  595 toggle public final LatexVo getLatex() {
62  595 return latex;
63    }
64   
 
65  1190 toggle public final void startElement(final String name, final SimpleAttributes attributes)
66    throws XmlSyntaxException {
67  1190 if (getStartTag().equals(name)) {
68    // ignore
69  595 } else if ("LATEX".equals(name)) {
70  595 this.data = null;
71  595 language = attributes.getString("language");
72    } else {
73  0 throw XmlSyntaxException.createUnexpectedTagException(name);
74    }
75    }
76   
 
77  1190 toggle public void endElement(final String name) throws XmlSyntaxException {
78  1190 if (getStartTag().equals(name)) {
79    // ignore
80  595 } else if ("LATEX".equals(name)) {
81  595 latex = new LatexVo(language, data);
82    } else {
83  0 throw XmlSyntaxException.createUnexpectedTagException(name);
84    }
85    }
86   
 
87  595 toggle public void characters(final String name, final String data) throws XmlSyntaxException {
88  595 if (getStartTag().equals(name)) {
89    // ignore
90  595 } else if ("LATEX".equals(name)) {
91  595 this.data = data;
92    } else {
93  0 throw XmlSyntaxException.createUnexpectedTextDataException(name, data);
94    }
95    }
96   
97    }