franta-hg@2
|
1 |
package cz.frantovo.alt2xml;
|
franta-hg@2
|
2 |
|
franta-hg@3
|
3 |
import cz.frantovo.alt2xml.vstup.SuperReader;
|
franta-hg@3
|
4 |
import java.util.logging.Level;
|
franta-hg@3
|
5 |
import java.util.logging.Logger;
|
franta-hg@2
|
6 |
import javax.xml.parsers.ParserConfigurationException;
|
franta-hg@2
|
7 |
import javax.xml.parsers.SAXParser;
|
franta-hg@2
|
8 |
import javax.xml.parsers.SAXParserFactory;
|
franta-hg@3
|
9 |
import org.xml.sax.Parser;
|
franta-hg@2
|
10 |
import org.xml.sax.SAXException;
|
franta-hg@2
|
11 |
import org.xml.sax.SAXNotRecognizedException;
|
franta-hg@2
|
12 |
import org.xml.sax.SAXNotSupportedException;
|
franta-hg@3
|
13 |
import org.xml.sax.XMLReader;
|
franta-hg@2
|
14 |
|
franta-hg@2
|
15 |
/**
|
franta-hg@2
|
16 |
*
|
franta-hg@2
|
17 |
* @author fiki
|
franta-hg@2
|
18 |
*/
|
franta-hg@2
|
19 |
public class SAXTovarna extends SAXParserFactory {
|
franta-hg@2
|
20 |
|
franta-hg@2
|
21 |
@Override
|
franta-hg@2
|
22 |
public SAXParser newSAXParser() throws ParserConfigurationException, SAXException {
|
franta-hg@3
|
23 |
return new MůjParser(new SuperReader());
|
franta-hg@2
|
24 |
}
|
franta-hg@2
|
25 |
|
franta-hg@2
|
26 |
@Override
|
franta-hg@2
|
27 |
public void setFeature(String name, boolean value) throws ParserConfigurationException, SAXNotRecognizedException, SAXNotSupportedException {
|
franta-hg@2
|
28 |
throw new UnsupportedOperationException("Not supported yet.");
|
franta-hg@2
|
29 |
}
|
franta-hg@2
|
30 |
|
franta-hg@2
|
31 |
@Override
|
franta-hg@2
|
32 |
public boolean getFeature(String name) throws ParserConfigurationException, SAXNotRecognizedException, SAXNotSupportedException {
|
franta-hg@2
|
33 |
throw new UnsupportedOperationException("Not supported yet.");
|
franta-hg@2
|
34 |
}
|
franta-hg@3
|
35 |
|
franta-hg@3
|
36 |
private static class MůjParser extends SAXParser {
|
franta-hg@3
|
37 |
|
franta-hg@3
|
38 |
private static final Logger log = Logger.getLogger(MůjParser.class.getName());
|
franta-hg@3
|
39 |
private XMLReader xmlReader;
|
franta-hg@3
|
40 |
|
franta-hg@3
|
41 |
public MůjParser(XMLReader xmlReader) {
|
franta-hg@3
|
42 |
this.xmlReader = xmlReader;
|
franta-hg@3
|
43 |
}
|
franta-hg@3
|
44 |
|
franta-hg@3
|
45 |
@Override
|
franta-hg@3
|
46 |
public Parser getParser() throws SAXException {
|
franta-hg@3
|
47 |
// TODO: dopsat
|
franta-hg@3
|
48 |
log.log(Level.FINE, "getParser");
|
franta-hg@3
|
49 |
return null;
|
franta-hg@3
|
50 |
}
|
franta-hg@3
|
51 |
|
franta-hg@3
|
52 |
@Override
|
franta-hg@3
|
53 |
public XMLReader getXMLReader() throws SAXException {
|
franta-hg@3
|
54 |
return xmlReader;
|
franta-hg@3
|
55 |
}
|
franta-hg@3
|
56 |
|
franta-hg@3
|
57 |
@Override
|
franta-hg@3
|
58 |
public boolean isNamespaceAware() {
|
franta-hg@3
|
59 |
// TODO: dopsat
|
franta-hg@3
|
60 |
log.log(Level.FINE, "isNamespaceAware");
|
franta-hg@3
|
61 |
return false;
|
franta-hg@3
|
62 |
}
|
franta-hg@3
|
63 |
|
franta-hg@3
|
64 |
@Override
|
franta-hg@3
|
65 |
public boolean isValidating() {
|
franta-hg@3
|
66 |
// TODO: dopsat
|
franta-hg@3
|
67 |
log.log(Level.FINE, "isValidating");
|
franta-hg@3
|
68 |
return false;
|
franta-hg@3
|
69 |
}
|
franta-hg@3
|
70 |
|
franta-hg@3
|
71 |
@Override
|
franta-hg@3
|
72 |
public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException {
|
franta-hg@3
|
73 |
// TODO: dopsat
|
franta-hg@3
|
74 |
log.log(Level.FINE, "setProperty: {0} = {1}", new Object[]{name, value});
|
franta-hg@3
|
75 |
}
|
franta-hg@3
|
76 |
|
franta-hg@3
|
77 |
@Override
|
franta-hg@3
|
78 |
public Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException {
|
franta-hg@3
|
79 |
// TODO: dopsat
|
franta-hg@3
|
80 |
log.log(Level.FINE, "getProperty: {0}", name);
|
franta-hg@3
|
81 |
return null;
|
franta-hg@3
|
82 |
}
|
franta-hg@3
|
83 |
}
|
franta-hg@3
|
84 |
} |