java/alt2xml-lib-input/src/cz/frantovo/alt2xml/AltSAXParser.java
author František Kučera <franta-hg@frantovo.cz>
Thu, 24 Oct 2019 21:56:03 +0200
changeset 111 e4900596abdb
parent 37 03f940508c72
permissions -rw-r--r--
fix license version: GNU GPLv3
     1 /**
     2  * Alt2XML
     3  * Copyright © 2014 František Kučera (frantovo.cz)
     4  *
     5  * This program is free software: you can redistribute it and/or modify
     6  * it under the terms of the GNU General Public License as published by
     7  * the Free Software Foundation, version 3 of the License.
     8  *
     9  * This program is distributed in the hope that it will be useful,
    10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    12  * GNU General Public License for more details.
    13  *
    14  * You should have received a copy of the GNU General Public License
    15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
    16  */
    17 package cz.frantovo.alt2xml;
    18 
    19 import javax.xml.parsers.SAXParser;
    20 import org.xml.sax.Parser;
    21 import org.xml.sax.SAXException;
    22 import org.xml.sax.SAXNotRecognizedException;
    23 import org.xml.sax.SAXNotSupportedException;
    24 import org.xml.sax.XMLReader;
    25 
    26 /**
    27  *
    28  * @author Ing. František Kučera (frantovo.cz)
    29  */
    30 public class AltSAXParser extends SAXParser {
    31 
    32 	private final XMLReader xmlReader;
    33 
    34 	public AltSAXParser(XMLReader xmlReader) {
    35 		this.xmlReader = xmlReader;
    36 	}
    37 
    38 	@Override
    39 	@Deprecated
    40 	public Parser getParser() throws SAXException {
    41 		throw new SAXException("Není podporováno.");
    42 	}
    43 
    44 	@Override
    45 	public XMLReader getXMLReader() throws SAXException {
    46 		return xmlReader;
    47 	}
    48 
    49 	@Override
    50 	public boolean isNamespaceAware() {
    51 		return true;
    52 	}
    53 
    54 	@Override
    55 	public boolean isValidating() {
    56 		return false;
    57 	}
    58 
    59 	@Override
    60 	public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException {
    61 		xmlReader.setProperty(name, value);
    62 	}
    63 
    64 	@Override
    65 	public Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException {
    66 		return xmlReader.getProperty(name);
    67 	}
    68 }