1.1 --- a/java/alt2xml-bin/src/cz/frantovo/alt2xml/vstup/SuperReader.java Sat Jun 07 10:38:31 2014 +0200
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,140 +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.vstup;
1.22 -
1.23 -import cz.frantovo.alt2xml.ReaderFinder;
1.24 -import java.io.IOException;
1.25 -import java.io.InputStreamReader;
1.26 -import java.util.HashMap;
1.27 -import java.util.Map;
1.28 -import org.xml.sax.ContentHandler;
1.29 -import org.xml.sax.DTDHandler;
1.30 -import org.xml.sax.EntityResolver;
1.31 -import org.xml.sax.ErrorHandler;
1.32 -import org.xml.sax.InputSource;
1.33 -import org.xml.sax.SAXException;
1.34 -import org.xml.sax.SAXNotRecognizedException;
1.35 -import org.xml.sax.SAXNotSupportedException;
1.36 -import org.xml.sax.XMLReader;
1.37 -
1.38 -/**
1.39 - *
1.40 - * @author fiki
1.41 - */
1.42 -public class SuperReader implements XMLReader {
1.43 -
1.44 - private ContentHandler contentHandler;
1.45 - private ErrorHandler errorHandler;
1.46 - private DTDHandler dtdHandler;
1.47 - private EntityResolver entityResolver;
1.48 - private Map<String, Object> konfigurace = new HashMap<>();
1.49 - private final ReaderFinder readerFinder;
1.50 -
1.51 - public SuperReader(ReaderFinder readerFinder) {
1.52 - this.readerFinder = readerFinder;
1.53 - }
1.54 -
1.55 - @Override
1.56 - public void parse(InputSource input) throws IOException, SAXException {
1.57 - /**
1.58 - * TODO: rozpornat formát vstupu a podle toho delegovat
1.59 - */
1.60 - //JSONParser p = new JSONParser();
1.61 - InputStreamReader vstup = new InputStreamReader(input.getByteStream());
1.62 - //JsonSimpleContentHandler handler = new JsonSimpleContentHandler(contentHandler);
1.63 -
1.64 - /*
1.65 - try {
1.66 - p.parse(vstup, handler);
1.67 - } catch (ParseException e) {
1.68 - throw new SAXException("Chyba při načítání JSONu", e);
1.69 - }
1.70 - */
1.71 - }
1.72 -
1.73 - @Override
1.74 - public void parse(String systemId) throws IOException, SAXException {
1.75 - parse(new InputSource(systemId));
1.76 - }
1.77 -
1.78 - @Override
1.79 - public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException {
1.80 - /**
1.81 - * TODO:
1.82 - * All XMLReaders are required to recognize
1.83 - * the http://xml.org/sax/features/namespaces
1.84 - * and the http://xml.org/sax/features/namespace-prefixes feature names.
1.85 - */
1.86 - throw new SAXNotSupportedException("Zatím není podporováno.");
1.87 - }
1.88 -
1.89 - @Override
1.90 - public void setFeature(String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException {
1.91 - throw new SAXNotSupportedException("Zatím není podporováno.");
1.92 - }
1.93 -
1.94 - @Override
1.95 - public Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException {
1.96 - return konfigurace.get(name);
1.97 - }
1.98 -
1.99 - @Override
1.100 - public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException {
1.101 - konfigurace.put(name, value);
1.102 - }
1.103 -
1.104 - @Override
1.105 - public void setEntityResolver(EntityResolver entityResolver) {
1.106 - this.entityResolver = entityResolver;
1.107 - }
1.108 -
1.109 - @Override
1.110 - public EntityResolver getEntityResolver() {
1.111 - return entityResolver;
1.112 - }
1.113 -
1.114 - @Override
1.115 - public void setDTDHandler(DTDHandler dtdHandler) {
1.116 - this.dtdHandler = dtdHandler;
1.117 - }
1.118 -
1.119 - @Override
1.120 - public DTDHandler getDTDHandler() {
1.121 - return dtdHandler;
1.122 - }
1.123 -
1.124 - @Override
1.125 - public void setContentHandler(ContentHandler contentHandler) {
1.126 - this.contentHandler = contentHandler;
1.127 - }
1.128 -
1.129 - @Override
1.130 - public ContentHandler getContentHandler() {
1.131 - return contentHandler;
1.132 - }
1.133 -
1.134 - @Override
1.135 - public void setErrorHandler(ErrorHandler errorHandler) {
1.136 - this.errorHandler = errorHandler;
1.137 - }
1.138 -
1.139 - @Override
1.140 - public ErrorHandler getErrorHandler() {
1.141 - return errorHandler;
1.142 - }
1.143 -}