|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| SaxErrorHandler.java | - | 42,9% | 25% | 36,4% |
|
||||||||||||||
| 1 | /* $Id: SaxErrorHandler.java,v 1.10 2006/10/20 20:23:04 m31 Exp $ | |
| 2 | * | |
| 3 | * This file is part of the project "Hilbert II" - http://www.qedeq.org | |
| 4 | * | |
| 5 | * Copyright 2000-2006, Michael Meyling <mime@qedeq.org>. | |
| 6 | * | |
| 7 | * "Hilbert II" is free software; you can redistribute | |
| 8 | * it and/or modify it under the terms of the GNU General Public | |
| 9 | * License as published by the Free Software Foundation; either | |
| 10 | * version 2 of the License, or (at your option) any later version. | |
| 11 | * | |
| 12 | * This program is distributed in the hope that it will be useful, | |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 15 | * GNU General Public License for more details. | |
| 16 | */ | |
| 17 | ||
| 18 | package org.qedeq.kernel.xml.parser; | |
| 19 | ||
| 20 | import java.net.URL; | |
| 21 | ||
| 22 | import org.xml.sax.ErrorHandler; | |
| 23 | import org.xml.sax.SAXException; | |
| 24 | import org.xml.sax.SAXParseException; | |
| 25 | ||
| 26 | ||
| 27 | /** | |
| 28 | * Error handler for XML parsing. | |
| 29 | * | |
| 30 | * @version $Revision: 1.10 $ | |
| 31 | * @author Michael Meyling | |
| 32 | */ | |
| 33 | public final class SaxErrorHandler implements ErrorHandler { | |
| 34 | ||
| 35 | /** File that is parsed. */ | |
| 36 | private final URL url; | |
| 37 | ||
| 38 | /** Collects errors. */ | |
| 39 | private final ExceptionList list; | |
| 40 | ||
| 41 | /** | |
| 42 | * Constructor. | |
| 43 | * | |
| 44 | * @param url URL that is parsed. | |
| 45 | * @param list Collector for the SAX exceptions. | |
| 46 | */ | |
| 47 | 356 | public SaxErrorHandler(final URL url, final ExceptionList list) { |
| 48 | 356 | super(); |
| 49 | 356 | this.url = url; |
| 50 | 356 | this.list = list; |
| 51 | } | |
| 52 | ||
| 53 | /* (non-Javadoc) | |
| 54 | * @see org.xml.sax.ErrorHandler#warning(org.xml.sax.SAXParseException) | |
| 55 | */ | |
| 56 | 0 | public final void warning(final SAXParseException e) throws SAXException { |
| 57 | 0 | list.add(new SyntaxException(e, url)); |
| 58 | } | |
| 59 | ||
| 60 | /* (non-Javadoc) | |
| 61 | * @see org.xml.sax.ErrorHandler#error(org.xml.sax.SAXParseException) | |
| 62 | */ | |
| 63 | 0 | public final void error(final SAXParseException e) throws SAXException { |
| 64 | 0 | list.add(new SyntaxException(e, url)); |
| 65 | } | |
| 66 | ||
| 67 | /* (non-Javadoc) | |
| 68 | * @see org.xml.sax.ErrorHandler#fatalError(org.xml.sax.SAXParseException) | |
| 69 | */ | |
| 70 | 0 | public final void fatalError(final SAXParseException e) throws SAXException { |
| 71 | 0 | list.add(new SyntaxException(e, url)); |
| 72 | 0 | throw e; |
| 73 | } | |
| 74 | ||
| 75 | } |
|
||||||||||