1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/java/alt2xml-bin/src/cz/frantovo/alt2xml/SAXTovarna.java Thu Jun 05 10:07:34 2014 +0200
1.3 @@ -0,0 +1,72 @@
1.4 +package cz.frantovo.alt2xml;
1.5 +
1.6 +import cz.frantovo.alt2xml.vstup.SuperReader;
1.7 +import javax.xml.parsers.ParserConfigurationException;
1.8 +import javax.xml.parsers.SAXParser;
1.9 +import javax.xml.parsers.SAXParserFactory;
1.10 +import org.xml.sax.Parser;
1.11 +import org.xml.sax.SAXException;
1.12 +import org.xml.sax.SAXNotRecognizedException;
1.13 +import org.xml.sax.SAXNotSupportedException;
1.14 +import org.xml.sax.XMLReader;
1.15 +
1.16 +/**
1.17 + *
1.18 + * @author fiki
1.19 + */
1.20 +public class SAXTovarna extends SAXParserFactory {
1.21 +
1.22 + @Override
1.23 + public SAXParser newSAXParser() throws ParserConfigurationException, SAXException {
1.24 + return new MůjParser(new SuperReader());
1.25 + }
1.26 +
1.27 + @Override
1.28 + public void setFeature(String name, boolean value) throws ParserConfigurationException, SAXNotRecognizedException, SAXNotSupportedException {
1.29 + throw new SAXNotSupportedException("Zatím není podporováno.");
1.30 + }
1.31 +
1.32 + @Override
1.33 + public boolean getFeature(String name) throws ParserConfigurationException, SAXNotRecognizedException, SAXNotSupportedException {
1.34 + throw new SAXNotSupportedException("Zatím není podporováno.");
1.35 + }
1.36 +
1.37 + private static class MůjParser extends SAXParser {
1.38 +
1.39 + private XMLReader xmlReader;
1.40 +
1.41 + public MůjParser(XMLReader xmlReader) {
1.42 + this.xmlReader = xmlReader;
1.43 + }
1.44 +
1.45 + @Override
1.46 + public Parser getParser() throws SAXException {
1.47 + throw new SAXException("Není podporováno.");
1.48 + }
1.49 +
1.50 + @Override
1.51 + public XMLReader getXMLReader() throws SAXException {
1.52 + return xmlReader;
1.53 + }
1.54 +
1.55 + @Override
1.56 + public boolean isNamespaceAware() {
1.57 + return false;
1.58 + }
1.59 +
1.60 + @Override
1.61 + public boolean isValidating() {
1.62 + return false;
1.63 + }
1.64 +
1.65 + @Override
1.66 + public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException {
1.67 + xmlReader.setProperty(name, value);
1.68 + }
1.69 +
1.70 + @Override
1.71 + public Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException {
1.72 + return xmlReader.getProperty(name);
1.73 + }
1.74 + }
1.75 +}
1.76 \ No newline at end of file