KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > thaiopensource > validate > schematron > XMLReaderImpl


1 package com.thaiopensource.validate.schematron;
2
3 import org.xml.sax.XMLReader JavaDoc;
4 import org.xml.sax.SAXException JavaDoc;
5 import org.xml.sax.InputSource JavaDoc;
6 import org.xml.sax.ErrorHandler JavaDoc;
7 import org.xml.sax.DTDHandler JavaDoc;
8 import org.xml.sax.EntityResolver JavaDoc;
9 import org.xml.sax.SAXNotRecognizedException JavaDoc;
10 import org.xml.sax.SAXNotSupportedException JavaDoc;
11
12 import java.io.IOException JavaDoc;
13
14 abstract class XMLReaderImpl implements XMLReader JavaDoc {
15   private ErrorHandler JavaDoc errorHandler;
16   private DTDHandler JavaDoc dtdHandler;
17   private EntityResolver JavaDoc entityResolver;
18
19   public void parse(String JavaDoc systemId)
20           throws SAXException JavaDoc, IOException JavaDoc {
21     parse(new InputSource JavaDoc(systemId));
22   }
23
24
25   public ErrorHandler JavaDoc getErrorHandler() {
26     return errorHandler;
27   }
28
29   public void setErrorHandler(ErrorHandler JavaDoc errorHandler) {
30     this.errorHandler = errorHandler;
31   }
32
33   public void setDTDHandler(DTDHandler JavaDoc handler) {
34     this.dtdHandler = handler;
35   }
36
37   public DTDHandler JavaDoc getDTDHandler() {
38     return dtdHandler;
39   }
40
41   public void setEntityResolver(EntityResolver JavaDoc resolver) {
42     this.entityResolver = resolver;
43   }
44
45   public EntityResolver JavaDoc getEntityResolver() {
46     return entityResolver;
47   }
48
49   public Object JavaDoc getProperty(String JavaDoc name)
50           throws SAXNotRecognizedException JavaDoc, SAXNotSupportedException JavaDoc {
51     throw new SAXNotRecognizedException JavaDoc(name);
52   }
53
54   public void setProperty(String JavaDoc name, Object JavaDoc value)
55           throws SAXNotRecognizedException JavaDoc, SAXNotSupportedException JavaDoc {
56     throw new SAXNotRecognizedException JavaDoc(name);
57   }
58
59   public boolean getFeature(String JavaDoc name)
60           throws SAXNotRecognizedException JavaDoc, SAXNotSupportedException JavaDoc {
61     if (name.equals("http://xml.org/sax/features/namespaces"))
62       return true;
63     if (name.equals("http://xml.org/sax/features/namespace-prefixes"))
64       return false;
65     throw new SAXNotRecognizedException JavaDoc(name);
66   }
67
68   public void setFeature(String JavaDoc name, boolean value)
69           throws SAXNotRecognizedException JavaDoc, SAXNotSupportedException JavaDoc {
70     if (name.equals("http://xml.org/sax/features/namespaces")) {
71       if (value == true)
72         return;
73       throw new SAXNotSupportedException JavaDoc(name);
74     }
75     if (name.equals("http://xml.org/sax/features/namespace-prefixes")) {
76       if (value == false)
77         return;
78       throw new SAXNotSupportedException JavaDoc(name);
79     }
80     throw new SAXNotRecognizedException JavaDoc(name);
81   }
82 }
83
Popular Tags