diff -r 6c608fd8c019 -r e2b2f34cdb50 java/alt2xml/src/cz/frantovo/alt2xml/vstup/SuperReader.java --- a/java/alt2xml/src/cz/frantovo/alt2xml/vstup/SuperReader.java Tue Jan 03 12:55:38 2012 +0100 +++ b/java/alt2xml/src/cz/frantovo/alt2xml/vstup/SuperReader.java Tue Jan 03 14:39:16 2012 +0100 @@ -2,8 +2,8 @@ import java.io.IOException; import java.io.InputStreamReader; -import java.util.logging.Level; -import java.util.logging.Logger; +import java.util.HashMap; +import java.util.Map; import org.json.simple.parser.JSONParser; import org.json.simple.parser.ParseException; import org.xml.sax.ContentHandler; @@ -22,84 +22,70 @@ */ public class SuperReader implements XMLReader { - private static final Logger log = Logger.getLogger(SuperReader.class.getName()); private ContentHandler contentHandler; + private ErrorHandler errorHandler; + private DTDHandler dtdHandler; + private EntityResolver entityResolver; + private Map konfigurace = new HashMap<>(); @Override public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException { - // TODO: dopsat - log.log(Level.FINE, "getFeature: {0}", name); - return false; + throw new SAXNotSupportedException("Zatím není podporováno."); } @Override public void setFeature(String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException { - // TODO: dopsat - log.log(Level.FINE, "setFeature: {0} = {1}", new Object[]{name, value}); + throw new SAXNotSupportedException("Zatím není podporováno."); } @Override public Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException { - // TODO: dopsat - log.log(Level.FINE, "getProperty: {0}", name); - return null; + return konfigurace.get(name); } @Override public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException { - // TODO: dopsat - log.log(Level.FINE, "setProperty: {0} = {1}", new Object[]{name, value}); + konfigurace.put(name, value); } @Override - public void setEntityResolver(EntityResolver resolver) { - // TODO: dopsat - log.log(Level.FINE, "setEntityResolver: {0}", resolver); + public void setEntityResolver(EntityResolver entityResolver) { + this.entityResolver = entityResolver; } @Override public EntityResolver getEntityResolver() { - // TODO: dopsat - log.log(Level.FINE, "getEntityResolver"); - return null; + return entityResolver; } @Override - public void setDTDHandler(DTDHandler handler) { - // TODO: dopsat - log.log(Level.FINE, "setDTDHandler: {0}", handler); + public void setDTDHandler(DTDHandler dtdHandler) { + this.dtdHandler = dtdHandler; } @Override public DTDHandler getDTDHandler() { - // TODO: dopsat - log.log(Level.FINE, "getDTDHandler"); - return null; + return dtdHandler; } @Override - public void setContentHandler(ContentHandler handler) { - // TODO: dopsat - contentHandler = handler; + public void setContentHandler(ContentHandler contentHandler) { + this.contentHandler = contentHandler; } @Override public ContentHandler getContentHandler() { - // TODO: dopsat return contentHandler; } @Override - public void setErrorHandler(ErrorHandler handler) { - // TODO: dopsat - log.log(Level.FINE, "setErrorHandler: {0}", handler); + public void setErrorHandler(ErrorHandler errorHandler) { + this.errorHandler = errorHandler; } @Override public ErrorHandler getErrorHandler() { - // TODO: dopsat - log.log(Level.FINE, "getErrorHandler"); - return null; + return errorHandler; } @Override @@ -107,7 +93,6 @@ /** * TODO: rozpornat formát vstupu a podle toho delegovat */ - JSONParser p = new JSONParser(); InputStreamReader vstup = new InputStreamReader(input.getByteStream()); JsonSimpleContentHandler handler = new JsonSimpleContentHandler(contentHandler); @@ -122,6 +107,6 @@ @Override public void parse(String systemId) throws IOException, SAXException { // TODO: dopsat - throw new UnsupportedOperationException("Zatím není podporované."); + throw new SAXException("Zatím není podporováno."); } }