1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.springframework.xml.sax;
18
19 import org.xml.sax.ContentHandler;
20 import org.xml.sax.DTDHandler;
21 import org.xml.sax.EntityResolver;
22 import org.xml.sax.ErrorHandler;
23 import org.xml.sax.SAXNotRecognizedException;
24 import org.xml.sax.SAXNotSupportedException;
25 import org.xml.sax.XMLReader;
26 import org.xml.sax.ext.LexicalHandler;
27
28
29
30
31
32
33
34
35
36
37
38
39 public abstract class AbstractXmlReader implements XMLReader {
40
41 private DTDHandler dtdHandler;
42
43 private ContentHandler contentHandler;
44
45 private EntityResolver entityResolver;
46
47 private ErrorHandler errorHandler;
48
49 private LexicalHandler lexicalHandler;
50
51 public ContentHandler getContentHandler() {
52 return contentHandler;
53 }
54
55 public void setContentHandler(ContentHandler contentHandler) {
56 this.contentHandler = contentHandler;
57 }
58
59 public void setDTDHandler(DTDHandler dtdHandler) {
60 this.dtdHandler = dtdHandler;
61 }
62
63 public DTDHandler getDTDHandler() {
64 return dtdHandler;
65 }
66
67 public EntityResolver getEntityResolver() {
68 return entityResolver;
69 }
70
71 public void setEntityResolver(EntityResolver entityResolver) {
72 this.entityResolver = entityResolver;
73 }
74
75 public ErrorHandler getErrorHandler() {
76 return errorHandler;
77 }
78
79 public void setErrorHandler(ErrorHandler errorHandler) {
80 this.errorHandler = errorHandler;
81 }
82
83 public LexicalHandler getLexicalHandler() {
84 return lexicalHandler;
85 }
86
87 public void setLexicalHandler(LexicalHandler lexicalHandler) {
88 this.lexicalHandler = lexicalHandler;
89 }
90
91
92
93
94
95
96
97 public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException {
98 throw new SAXNotRecognizedException(name);
99 }
100
101
102
103
104
105
106 public void setFeature(String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException {
107 throw new SAXNotRecognizedException(name);
108 }
109
110
111
112
113
114 public Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException {
115 if ("http://xml.org/sax/properties/lexical-handler".equals(name)) {
116 return lexicalHandler;
117 }
118 else {
119 throw new SAXNotRecognizedException(name);
120 }
121 }
122
123
124
125
126
127 public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException {
128 if ("http://xml.org/sax/properties/lexical-handler".equals(name)) {
129 lexicalHandler = (LexicalHandler) value;
130 }
131 else {
132 throw new SAXNotRecognizedException(name);
133 }
134 }
135 }