java/alt2xml-lib-input/src/cz/frantovo/alt2xml/AltSAXParser.java
changeset 37 03f940508c72
child 111 e4900596abdb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/java/alt2xml-lib-input/src/cz/frantovo/alt2xml/AltSAXParser.java	Sun Jun 08 09:57:33 2014 +0200
     1.3 @@ -0,0 +1,69 @@
     1.4 +/**
     1.5 + * Alt2XML
     1.6 + * Copyright © 2014 František Kučera (frantovo.cz)
     1.7 + *
     1.8 + * This program is free software: you can redistribute it and/or modify
     1.9 + * it under the terms of the GNU General Public License as published by
    1.10 + * the Free Software Foundation, either version 3 of the License, or
    1.11 + * (at your option) any later version.
    1.12 + *
    1.13 + * This program is distributed in the hope that it will be useful,
    1.14 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.15 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    1.16 + * GNU General Public License for more details.
    1.17 + *
    1.18 + * You should have received a copy of the GNU General Public License
    1.19 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
    1.20 + */
    1.21 +package cz.frantovo.alt2xml;
    1.22 +
    1.23 +import javax.xml.parsers.SAXParser;
    1.24 +import org.xml.sax.Parser;
    1.25 +import org.xml.sax.SAXException;
    1.26 +import org.xml.sax.SAXNotRecognizedException;
    1.27 +import org.xml.sax.SAXNotSupportedException;
    1.28 +import org.xml.sax.XMLReader;
    1.29 +
    1.30 +/**
    1.31 + *
    1.32 + * @author Ing. František Kučera (frantovo.cz)
    1.33 + */
    1.34 +public class AltSAXParser extends SAXParser {
    1.35 +
    1.36 +	private final XMLReader xmlReader;
    1.37 +
    1.38 +	public AltSAXParser(XMLReader xmlReader) {
    1.39 +		this.xmlReader = xmlReader;
    1.40 +	}
    1.41 +
    1.42 +	@Override
    1.43 +	@Deprecated
    1.44 +	public Parser getParser() throws SAXException {
    1.45 +		throw new SAXException("Není podporováno.");
    1.46 +	}
    1.47 +
    1.48 +	@Override
    1.49 +	public XMLReader getXMLReader() throws SAXException {
    1.50 +		return xmlReader;
    1.51 +	}
    1.52 +
    1.53 +	@Override
    1.54 +	public boolean isNamespaceAware() {
    1.55 +		return true;
    1.56 +	}
    1.57 +
    1.58 +	@Override
    1.59 +	public boolean isValidating() {
    1.60 +		return false;
    1.61 +	}
    1.62 +
    1.63 +	@Override
    1.64 +	public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException {
    1.65 +		xmlReader.setProperty(name, value);
    1.66 +	}
    1.67 +
    1.68 +	@Override
    1.69 +	public Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException {
    1.70 +		return xmlReader.getProperty(name);
    1.71 +	}
    1.72 +}