1.1 --- a/java/alt2xml-lib/src/cz/frantovo/alt2xml/AbstractAlt2XmlReader.java Sat Jun 07 21:57:50 2014 +0200
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,116 +0,0 @@
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 java.io.IOException;
1.24 -import java.util.HashMap;
1.25 -import java.util.Map;
1.26 -import org.xml.sax.ContentHandler;
1.27 -import org.xml.sax.DTDHandler;
1.28 -import org.xml.sax.EntityResolver;
1.29 -import org.xml.sax.ErrorHandler;
1.30 -import org.xml.sax.InputSource;
1.31 -import org.xml.sax.SAXException;
1.32 -import org.xml.sax.SAXNotRecognizedException;
1.33 -import org.xml.sax.SAXNotSupportedException;
1.34 -import org.xml.sax.XMLReader;
1.35 -
1.36 -/**
1.37 - * Recommended base class for all alternative format readers.
1.38 - *
1.39 - * @author Ing. František Kučera (frantovo.cz)
1.40 - */
1.41 -public abstract class AbstractAlt2XmlReader implements XMLReader {
1.42 -
1.43 - protected ContentHandler contentHandler;
1.44 - protected ErrorHandler errorHandler;
1.45 - protected DTDHandler dtdHandler;
1.46 - protected EntityResolver entityResolver;
1.47 - protected Map<String, Object> properties = new HashMap<>();
1.48 -
1.49 - @Override
1.50 - public void parse(String systemId) throws IOException, SAXException {
1.51 - parse(new InputSource(systemId));
1.52 - }
1.53 -
1.54 - @Override
1.55 - public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException {
1.56 - /**
1.57 - * TODO:
1.58 - * All XMLReaders are required to recognize
1.59 - * the http://xml.org/sax/features/namespaces
1.60 - * and the http://xml.org/sax/features/namespace-prefixes feature names.
1.61 - */
1.62 - throw new SAXNotSupportedException("Zatím není podporováno.");
1.63 - }
1.64 -
1.65 - @Override
1.66 - public void setFeature(String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException {
1.67 - throw new SAXNotSupportedException("Zatím není podporováno.");
1.68 - }
1.69 -
1.70 - @Override
1.71 - public Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException {
1.72 - return properties.get(name);
1.73 - }
1.74 -
1.75 - @Override
1.76 - public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException {
1.77 - properties.put(name, value);
1.78 - }
1.79 -
1.80 - @Override
1.81 - public void setEntityResolver(EntityResolver entityResolver) {
1.82 - this.entityResolver = entityResolver;
1.83 - }
1.84 -
1.85 - @Override
1.86 - public EntityResolver getEntityResolver() {
1.87 - return entityResolver;
1.88 - }
1.89 -
1.90 - @Override
1.91 - public void setDTDHandler(DTDHandler dtdHandler) {
1.92 - this.dtdHandler = dtdHandler;
1.93 - }
1.94 -
1.95 - @Override
1.96 - public DTDHandler getDTDHandler() {
1.97 - return dtdHandler;
1.98 - }
1.99 -
1.100 - @Override
1.101 - public void setContentHandler(ContentHandler contentHandler) {
1.102 - this.contentHandler = contentHandler;
1.103 - }
1.104 -
1.105 - @Override
1.106 - public ContentHandler getContentHandler() {
1.107 - return contentHandler;
1.108 - }
1.109 -
1.110 - @Override
1.111 - public void setErrorHandler(ErrorHandler errorHandler) {
1.112 - this.errorHandler = errorHandler;
1.113 - }
1.114 -
1.115 - @Override
1.116 - public ErrorHandler getErrorHandler() {
1.117 - return errorHandler;
1.118 - }
1.119 -}