diff -r 5cfb685d8eec -r 9107f7df660c java/alt2xml-bin/src/cz/frantovo/alt2xml/SAXTovarna.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/alt2xml-bin/src/cz/frantovo/alt2xml/SAXTovarna.java Thu Jun 05 10:07:34 2014 +0200 @@ -0,0 +1,72 @@ +package cz.frantovo.alt2xml; + +import cz.frantovo.alt2xml.vstup.SuperReader; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.parsers.SAXParser; +import javax.xml.parsers.SAXParserFactory; +import org.xml.sax.Parser; +import org.xml.sax.SAXException; +import org.xml.sax.SAXNotRecognizedException; +import org.xml.sax.SAXNotSupportedException; +import org.xml.sax.XMLReader; + +/** + * + * @author fiki + */ +public class SAXTovarna extends SAXParserFactory { + + @Override + public SAXParser newSAXParser() throws ParserConfigurationException, SAXException { + return new MůjParser(new SuperReader()); + } + + @Override + public void setFeature(String name, boolean value) throws ParserConfigurationException, SAXNotRecognizedException, SAXNotSupportedException { + throw new SAXNotSupportedException("Zatím není podporováno."); + } + + @Override + public boolean getFeature(String name) throws ParserConfigurationException, SAXNotRecognizedException, SAXNotSupportedException { + throw new SAXNotSupportedException("Zatím není podporováno."); + } + + private static class MůjParser extends SAXParser { + + private XMLReader xmlReader; + + public MůjParser(XMLReader xmlReader) { + this.xmlReader = xmlReader; + } + + @Override + public Parser getParser() throws SAXException { + throw new SAXException("Není podporováno."); + } + + @Override + public XMLReader getXMLReader() throws SAXException { + return xmlReader; + } + + @Override + public boolean isNamespaceAware() { + return false; + } + + @Override + public boolean isValidating() { + return false; + } + + @Override + public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException { + xmlReader.setProperty(name, value); + } + + @Override + public Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException { + return xmlReader.getProperty(name); + } + } +} \ No newline at end of file