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