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