001: package javax.xml.stream.util;
002:
003: import java.io.Reader;
004: import javax.xml.namespace.QName;
005: import javax.xml.namespace.NamespaceContext;
006: import javax.xml.stream.XMLStreamReader;
007: import javax.xml.stream.Location;
008: import javax.xml.stream.XMLStreamException;
009:
010: /**
011: * This is the base class for deriving an XMLStreamReader filter
012: *
013: * This class is designed to sit between an XMLStreamReader and an
014: * application's XMLStreamReader. By default each method
015: * does nothing but call the corresponding method on the
016: * parent interface.
017: *
018: * @version 1.0
019: * @author Copyright (c) 2003 by BEA Systems. All Rights Reserved.
020: * @see javax.xml.stream.XMLStreamReader
021: * @see EventReaderDelegate
022: */
023:
024: public class StreamReaderDelegate implements XMLStreamReader {
025: private XMLStreamReader reader;
026:
027: /**
028: * Construct an empty filter with no parent.
029: */
030: public StreamReaderDelegate() {
031: }
032:
033: /**
034: * Construct an filter with the specified parent.
035: * @param reader the parent
036: */
037: public StreamReaderDelegate(XMLStreamReader reader) {
038: this .reader = reader;
039: }
040:
041: /**
042: * Set the parent of this instance.
043: * @param reader the new parent
044: */
045: public void setParent(XMLStreamReader reader) {
046: this .reader = reader;
047: }
048:
049: /**
050: * Get the parent of this instance.
051: * @return the parent or null if none is set
052: */
053: public XMLStreamReader getParent() {
054: return reader;
055: }
056:
057: public int next() throws XMLStreamException {
058: return reader.next();
059: }
060:
061: public int nextTag() throws XMLStreamException {
062: return reader.nextTag();
063: }
064:
065: public String getElementText() throws XMLStreamException {
066: return reader.getElementText();
067: }
068:
069: public void require(int type, String namespaceURI, String localName)
070: throws XMLStreamException {
071: reader.require(type, namespaceURI, localName);
072: }
073:
074: public boolean hasNext() throws XMLStreamException {
075: return reader.hasNext();
076: }
077:
078: public void close() throws XMLStreamException {
079: reader.close();
080: }
081:
082: public String getNamespaceURI(String prefix) {
083: return reader.getNamespaceURI(prefix);
084: }
085:
086: public NamespaceContext getNamespaceContext() {
087: return reader.getNamespaceContext();
088: }
089:
090: public boolean isStartElement() {
091: return reader.isStartElement();
092: }
093:
094: public boolean isEndElement() {
095: return reader.isEndElement();
096: }
097:
098: public boolean isCharacters() {
099: return reader.isCharacters();
100: }
101:
102: public boolean isWhiteSpace() {
103: return reader.isWhiteSpace();
104: }
105:
106: public String getAttributeValue(String namespaceUri,
107: String localName) {
108: return reader.getAttributeValue(namespaceUri, localName);
109: }
110:
111: public int getAttributeCount() {
112: return reader.getAttributeCount();
113: }
114:
115: public QName getAttributeName(int index) {
116: return reader.getAttributeName(index);
117: }
118:
119: public String getAttributePrefix(int index) {
120: return reader.getAttributePrefix(index);
121: }
122:
123: public String getAttributeNamespace(int index) {
124: return reader.getAttributeNamespace(index);
125: }
126:
127: public String getAttributeLocalName(int index) {
128: return reader.getAttributeLocalName(index);
129: }
130:
131: public String getAttributeType(int index) {
132: return reader.getAttributeType(index);
133: }
134:
135: public String getAttributeValue(int index) {
136: return reader.getAttributeValue(index);
137: }
138:
139: public boolean isAttributeSpecified(int index) {
140: return reader.isAttributeSpecified(index);
141: }
142:
143: public int getNamespaceCount() {
144: return reader.getNamespaceCount();
145: }
146:
147: public String getNamespacePrefix(int index) {
148: return reader.getNamespacePrefix(index);
149: }
150:
151: public String getNamespaceURI(int index) {
152: return reader.getNamespaceURI(index);
153: }
154:
155: public int getEventType() {
156: return reader.getEventType();
157: }
158:
159: public String getText() {
160: return reader.getText();
161: }
162:
163: public int getTextCharacters(int sourceStart, char[] target,
164: int targetStart, int length) throws XMLStreamException {
165: return reader.getTextCharacters(sourceStart, target,
166: targetStart, length);
167: }
168:
169: public char[] getTextCharacters() {
170: return reader.getTextCharacters();
171: }
172:
173: public int getTextStart() {
174: return reader.getTextStart();
175: }
176:
177: public int getTextLength() {
178: return reader.getTextLength();
179: }
180:
181: public String getEncoding() {
182: return reader.getEncoding();
183: }
184:
185: public boolean hasText() {
186: return reader.hasText();
187: }
188:
189: public Location getLocation() {
190: return reader.getLocation();
191: }
192:
193: public QName getName() {
194: return reader.getName();
195: }
196:
197: public String getLocalName() {
198: return reader.getLocalName();
199: }
200:
201: public boolean hasName() {
202: return reader.hasName();
203: }
204:
205: public String getNamespaceURI() {
206: return reader.getNamespaceURI();
207: }
208:
209: public String getPrefix() {
210: return reader.getPrefix();
211: }
212:
213: public String getVersion() {
214: return reader.getVersion();
215: }
216:
217: public boolean isStandalone() {
218: return reader.isStandalone();
219: }
220:
221: public boolean standaloneSet() {
222: return reader.standaloneSet();
223: }
224:
225: public String getCharacterEncodingScheme() {
226: return reader.getCharacterEncodingScheme();
227: }
228:
229: public String getPITarget() {
230: return reader.getPITarget();
231: }
232:
233: public String getPIData() {
234: return reader.getPIData();
235: }
236:
237: public Object getProperty(String name) {
238: return reader.getProperty(name);
239: }
240: }
|