1:
37:
38: package ;
39:
40: import ;
41: import ;
42: import ;
43: import ;
44: import ;
45: import ;
46:
47:
50: public class StreamReaderDelegate
51: implements XMLStreamReader, XMLStreamConstants
52: {
53:
54: private XMLStreamReader parent;
55:
56:
59: public StreamReaderDelegate()
60: {
61: }
62:
63:
66: public StreamReaderDelegate(XMLStreamReader reader)
67: {
68: parent = reader;
69: }
70:
71:
74: public void setParent(XMLStreamReader reader)
75: {
76: parent = reader;
77: }
78:
79:
82: public XMLStreamReader getParent()
83: {
84: return parent;
85: }
86:
87: public int next()
88: throws XMLStreamException
89: {
90: if (parent != null)
91: return parent.next();
92: throw new XMLStreamException();
93: }
94:
95: public int nextTag()
96: throws XMLStreamException
97: {
98: if (parent != null)
99: return parent.nextTag();
100: throw new XMLStreamException();
101: }
102:
103: public String getElementText()
104: throws XMLStreamException
105: {
106: if (parent != null)
107: return parent.getElementText();
108: throw new XMLStreamException();
109: }
110:
111: public void require(int type, String namespaceURI, String localName)
112: throws XMLStreamException
113: {
114: if (parent != null)
115: parent.require(type, namespaceURI, localName);
116: }
117:
118: public boolean hasNext()
119: throws XMLStreamException
120: {
121: if (parent != null)
122: return parent.hasNext();
123: return false;
124: }
125:
126: public void close()
127: throws XMLStreamException
128: {
129: if (parent != null)
130: parent.close();
131: }
132:
133: public String getNamespaceURI(String prefix)
134: {
135: if (parent != null)
136: return parent.getNamespaceURI(prefix);
137: return null;
138: }
139:
140: public NamespaceContext getNamespaceContext()
141: {
142: if (parent != null)
143: return parent.getNamespaceContext();
144: return null;
145: }
146:
147: public boolean isStartElement()
148: {
149: if (parent != null)
150: return parent.isStartElement();
151: return false;
152: }
153:
154: public boolean isEndElement()
155: {
156: if (parent != null)
157: return parent.isEndElement();
158: return false;
159: }
160:
161: public boolean isCharacters()
162: {
163: if (parent != null)
164: return parent.isCharacters();
165: return false;
166: }
167:
168: public boolean isWhiteSpace()
169: {
170: if (parent != null)
171: return parent.isWhiteSpace();
172: return false;
173: }
174:
175: public String getAttributeValue(String namespaceUri, String localName)
176: {
177: if (parent != null)
178: return parent.getAttributeValue(namespaceUri, localName);
179: return null;
180: }
181:
182: public int getAttributeCount()
183: {
184: if (parent != null)
185: return parent.getAttributeCount();
186: return 0;
187: }
188:
189: public QName getAttributeName(int index)
190: {
191: if (parent != null)
192: return parent.getAttributeName(index);
193: return null;
194: }
195:
196: public String getAttributePrefix(int index)
197: {
198: if (parent != null)
199: return parent.getAttributePrefix(index);
200: return null;
201: }
202:
203: public String getAttributeNamespace(int index)
204: {
205: if (parent != null)
206: return parent.getAttributeNamespace(index);
207: return null;
208: }
209:
210: public String getAttributeLocalName(int index)
211: {
212: if (parent != null)
213: return parent.getAttributeLocalName(index);
214: return null;
215: }
216:
217: public String getAttributeType(int index)
218: {
219: if (parent != null)
220: return parent.getAttributeType(index);
221: return null;
222: }
223:
224: public String getAttributeValue(int index)
225: {
226: if (parent != null)
227: return parent.getAttributeValue(index);
228: return null;
229: }
230:
231: public boolean isAttributeSpecified(int index)
232: {
233: if (parent != null)
234: return parent.isAttributeSpecified(index);
235: return false;
236: }
237:
238: public int getNamespaceCount()
239: {
240: if (parent != null)
241: return parent.getNamespaceCount();
242: return 0;
243: }
244:
245: public String getNamespacePrefix(int index)
246: {
247: if (parent != null)
248: return parent.getNamespacePrefix(index);
249: return null;
250: }
251:
252: public String getNamespaceURI(int index)
253: {
254: if (parent != null)
255: return parent.getNamespaceURI(index);
256: return null;
257: }
258:
259: public int getEventType()
260: {
261: if (parent != null)
262: return parent.getEventType();
263: return 0;
264: }
265:
266: public String getText()
267: {
268: if (parent != null)
269: return parent.getText();
270: return null;
271: }
272:
273: public int getTextCharacters(int sourceStart, char[] target,
274: int targetStart, int length)
275: throws XMLStreamException
276: {
277: if (parent != null)
278: return parent.getTextCharacters(sourceStart, target, targetStart, length);
279: return 0;
280: }
281:
282: public char[] getTextCharacters()
283: {
284: if (parent != null)
285: return parent.getTextCharacters();
286: return null;
287: }
288:
289: public int getTextStart()
290: {
291: if (parent != null)
292: return parent.getTextStart();
293: return 0;
294: }
295:
296: public int getTextLength()
297: {
298: if (parent != null)
299: return parent.getTextLength();
300: return 0;
301: }
302:
303: public String getEncoding()
304: {
305: if (parent != null)
306: return parent.getEncoding();
307: return null;
308: }
309:
310: public boolean hasText()
311: {
312: if (parent != null)
313: return parent.hasText();
314: return false;
315: }
316:
317: public Location getLocation()
318: {
319: if (parent != null)
320: return parent.getLocation();
321: return null;
322: }
323:
324: public QName getName()
325: {
326: if (parent != null)
327: return parent.getName();
328: return null;
329: }
330:
331: public String getLocalName()
332: {
333: if (parent != null)
334: return parent.getLocalName();
335: return null;
336: }
337:
338: public boolean hasName()
339: {
340: if (parent != null)
341: return parent.hasName();
342: return false;
343: }
344:
345: public String getNamespaceURI()
346: {
347: if (parent != null)
348: return parent.getNamespaceURI();
349: return null;
350: }
351:
352: public String getPrefix()
353: {
354: if (parent != null)
355: return parent.getPrefix();
356: return null;
357: }
358:
359: public String getVersion()
360: {
361: if (parent != null)
362: return parent.getVersion();
363: return null;
364: }
365:
366: public boolean isStandalone()
367: {
368: if (parent != null)
369: return parent.isStandalone();
370: return false;
371: }
372:
373: public boolean standaloneSet()
374: {
375: if (parent != null)
376: return parent.standaloneSet();
377: return false;
378: }
379:
380: public String getCharacterEncodingScheme()
381: {
382: if (parent != null)
383: return parent.getCharacterEncodingScheme();
384: return null;
385: }
386:
387: public String getPITarget()
388: {
389: if (parent != null)
390: return parent.getPITarget();
391: return null;
392: }
393:
394: public String getPIData()
395: {
396: if (parent != null)
397: return parent.getPIData();
398: return null;
399: }
400:
401: public Object getProperty(String name)
402: {
403: if (parent != null)
404: return parent.getProperty(name);
405: throw new IllegalArgumentException();
406: }
407:
408: }