1 /* ReaderDelegate.java --
2 Copyright (C) 2005 Free Software Foundation, Inc.
4 This file is part of GNU Classpath.
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING. If not, write to the
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library. Thus, the terms and
23 conditions of the GNU General Public License cover the whole
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module. An independent module is a module which is not derived from
33 or based on this library. If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so. If you do not wish to do so, delete this
36 exception statement from your version. */
38 package javax
.xml
.stream
.util
;
40 import javax
.xml
.namespace
.NamespaceContext
;
41 import javax
.xml
.namespace
.QName
;
42 import javax
.xml
.stream
.Location
;
43 import javax
.xml
.stream
.XMLStreamConstants
;
44 import javax
.xml
.stream
.XMLStreamException
;
45 import javax
.xml
.stream
.XMLStreamReader
;
48 * Base class for XML stream reader filters.
50 public class ReaderDelegate
51 implements XMLStreamReader
, XMLStreamConstants
54 private XMLStreamReader parent
;
57 * Constructs an empty filter with no parent set.
59 public ReaderDelegate()
64 * Constructs an empty filter with the specfied parent.
66 public ReaderDelegate(XMLStreamReader reader
)
74 public void setParent(XMLStreamReader reader
)
82 public XMLStreamReader
getParent()
88 throws XMLStreamException
92 throw new XMLStreamException();
96 throws XMLStreamException
99 return parent
.nextTag();
100 throw new XMLStreamException();
103 public String
getElementText()
104 throws XMLStreamException
107 return parent
.getElementText();
108 throw new XMLStreamException();
111 public void require(int type
, String namespaceURI
, String localName
)
112 throws XMLStreamException
115 parent
.require(type
, namespaceURI
, localName
);
118 public boolean hasNext()
119 throws XMLStreamException
122 return parent
.hasNext();
127 throws XMLStreamException
133 public String
getNamespaceURI(String prefix
)
136 return parent
.getNamespaceURI(prefix
);
140 public NamespaceContext
getNamespaceContext()
143 return parent
.getNamespaceContext();
147 public boolean isStartElement()
150 return parent
.isStartElement();
154 public boolean isEndElement()
157 return parent
.isEndElement();
161 public boolean isCharacters()
164 return parent
.isCharacters();
168 public boolean isWhiteSpace()
171 return parent
.isWhiteSpace();
175 public String
getAttributeValue(String namespaceUri
, String localName
)
178 return parent
.getAttributeValue(namespaceUri
, localName
);
182 public int getAttributeCount()
185 return parent
.getAttributeCount();
189 public QName
getAttributeQName(int index
)
192 return parent
.getAttributeQName(index
);
196 public String
getAttributePrefix(int index
)
199 return parent
.getAttributePrefix(index
);
203 public String
getAttributeNamespace(int index
)
206 return parent
.getAttributeNamespace(index
);
210 public String
getAttributeName(int index
)
213 return parent
.getAttributeName(index
);
217 public String
getAttributeType(int index
)
220 return parent
.getAttributeType(index
);
224 public String
getAttributeValue(int index
)
227 return parent
.getAttributeValue(index
);
231 public boolean isAttributeSpecified(int index
)
234 return parent
.isAttributeSpecified(index
);
238 public int getNamespaceCount()
241 return parent
.getNamespaceCount();
245 public String
getNamespacePrefix(int index
)
248 return parent
.getNamespacePrefix(index
);
252 public String
getNamespaceURI(int index
)
255 return parent
.getNamespaceURI(index
);
259 public int getEventType()
262 return parent
.getEventType();
266 public String
getText()
269 return parent
.getText();
273 public int getTextCharacters(int sourceStart
, char[] target
,
274 int targetStart
, int length
)
275 throws XMLStreamException
278 return parent
.getTextCharacters(sourceStart
, target
, targetStart
, length
);
282 public char[] getTextCharacters()
285 return parent
.getTextCharacters();
289 public int getTextStart()
292 return parent
.getTextStart();
296 public int getTextLength()
299 return parent
.getTextLength();
303 public String
getEncoding()
306 return parent
.getEncoding();
310 public boolean hasText()
313 return parent
.hasText();
317 public Location
getLocation()
320 return parent
.getLocation();
324 public QName
getName()
327 return parent
.getName();
331 public String
getLocalName()
334 return parent
.getLocalName();
338 public boolean hasName()
341 return parent
.hasName();
345 public String
getNamespaceURI()
348 return parent
.getNamespaceURI();
352 public String
getPrefix()
355 return parent
.getPrefix();
359 public String
getVersion()
362 return parent
.getVersion();
366 public boolean isStandalone()
369 return parent
.isStandalone();
373 public boolean standaloneSet()
376 return parent
.standaloneSet();
380 public String
getCharacterEncodingScheme()
383 return parent
.getCharacterEncodingScheme();
387 public String
getPITarget()
390 return parent
.getPITarget();
394 public String
getPIData()
397 return parent
.getPIData();
401 public Object
getProperty(String name
)
404 return parent
.getProperty(name
);
405 throw new IllegalArgumentException();