01: // Copyright (c) 2002 Per M.A. Bothner.
02: // This is free software; for terms and warranty disclaimer see ./COPYING.
03:
04: package gnu.kawa.sax;
05:
06: import org.xml.sax.*;
07: import gnu.xml.*;
08: import java.io.*;
09: import gnu.text.*;
10:
11: /** An implementation of SAX2 XMLReader.
12: */
13:
14: public class KawaXMLReader extends ContentConsumer implements XMLReader {
15: public boolean getFeature(String name) {
16: return false;
17: }
18:
19: public void setFeature(String name, boolean value) {
20: }
21:
22: public Object getProperty(String name) {
23: return null;
24: }
25:
26: public void setProperty(String name, Object value) {
27: }
28:
29: public void setEntityResolver(EntityResolver resolver) {
30: }
31:
32: public EntityResolver getEntityResolver() {
33: return null;
34: }
35:
36: public void setDTDHandler(DTDHandler handler) {
37: }
38:
39: public DTDHandler getDTDHandler() {
40: return null;
41: }
42:
43: ErrorHandler errorHandler;
44:
45: public void setErrorHandler(ErrorHandler handler) {
46: errorHandler = handler;
47: }
48:
49: public ErrorHandler getErrorHandler() {
50: return errorHandler;
51: }
52:
53: public void parse(InputSource input) throws IOException,
54: SAXException {
55: Reader reader = input.getCharacterStream();
56: if (reader == null)
57: reader = XMLParser.XMLStreamReader(input.getByteStream());
58: SourceMessages messages = new SourceMessages();
59: gnu.xml.XMLFilter filter = new gnu.xml.XMLFilter(this );
60: LineBufferedReader lin = new LineBufferedReader(reader);
61: filter.setSourceLocator(lin);
62: getContentHandler().setDocumentLocator(filter);
63: XMLParser.parse(lin, messages, filter);
64: String err = messages.toString(20);
65: if (err != null)
66: throw new SAXParseException(err, filter);
67: }
68:
69: public void parse(String systemId) {
70: }
71: }
|