01: package javax.xml.stream.util;
02:
03: import javax.xml.namespace.QName;
04: import javax.xml.namespace.NamespaceContext;
05: import javax.xml.stream.XMLEventReader;
06: import javax.xml.stream.events.XMLEvent;
07: import javax.xml.stream.Location;
08: import javax.xml.stream.XMLStreamException;
09:
10: /**
11: * This is the base class for deriving an XMLEventReader
12: * filter.
13: *
14: * This class is designed to sit between an XMLEventReader and an
15: * application's XMLEventReader. By default each method
16: * does nothing but call the corresponding method on the
17: * parent interface.
18: *
19: * @version 1.0
20: * @author Copyright (c) 2003 by BEA Systems. All Rights Reserved.
21: * @see javax.xml.stream.XMLEventReader
22: * @see StreamReaderDelegate
23: */
24:
25: public class EventReaderDelegate implements XMLEventReader {
26: private XMLEventReader reader;
27:
28: /**
29: * Construct an empty filter with no parent.
30: */
31: public EventReaderDelegate() {
32: }
33:
34: /**
35: * Construct an filter with the specified parent.
36: * @param reader the parent
37: */
38: public EventReaderDelegate(XMLEventReader reader) {
39: this .reader = reader;
40: }
41:
42: /**
43: * Set the parent of this instance.
44: * @param reader the new parent
45: */
46: public void setParent(XMLEventReader reader) {
47: this .reader = reader;
48: }
49:
50: /**
51: * Get the parent of this instance.
52: * @return the parent or null if none is set
53: */
54: public XMLEventReader getParent() {
55: return reader;
56: }
57:
58: public XMLEvent nextEvent() throws XMLStreamException {
59: return reader.nextEvent();
60: }
61:
62: public Object next() {
63: return reader.next();
64: }
65:
66: public boolean hasNext() {
67: return reader.hasNext();
68: }
69:
70: public XMLEvent peek() throws XMLStreamException {
71: return reader.peek();
72: }
73:
74: public void close() throws XMLStreamException {
75: reader.close();
76: }
77:
78: public String getElementText() throws XMLStreamException {
79: return reader.getElementText();
80: }
81:
82: public XMLEvent nextTag() throws XMLStreamException {
83: return reader.nextTag();
84: }
85:
86: public Object getProperty(java.lang.String name)
87: throws java.lang.IllegalArgumentException {
88: return reader.getProperty(name);
89: }
90:
91: public void remove() {
92: reader.remove();
93: }
94: }
|