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 protected LexicalHandler getLexicalHandler() {
84 return lexicalHandler;
85 }
86
87
88
89
90
91
92
93 public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException {
94 throw new SAXNotRecognizedException(name);
95 }
96
97
98
99
100
101
102 public void setFeature(String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException {
103 throw new SAXNotRecognizedException(name);
104 }
105
106
107
108
109
110 public Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException {
111 if ("http://xml.org/sax/properties/lexical-handler".equals(name)) {
112 return lexicalHandler;
113 }
114 else {
115 throw new SAXNotRecognizedException(name);
116 }
117 }
118
119
120
121
122
123 public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException {
124 if ("http://xml.org/sax/properties/lexical-handler".equals(name)) {
125 lexicalHandler = (LexicalHandler) value;
126 }
127 else {
128 throw new SAXNotRecognizedException(name);
129 }
130 }
131 }