View Javadoc

1   /*   Copyright 2004 BEA Systems, Inc.
2    *
3    *   Licensed under the Apache License, Version 2.0 (the "License");
4    *   you may not use this file except in compliance with the License.
5    *   You may obtain a copy of the License at
6    *
7    *       http://www.apache.org/licenses/LICENSE-2.0
8    *
9    *   Unless required by applicable law or agreed to in writing, software
10   *   distributed under the License is distributed on an "AS IS" BASIS,
11   *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12   *   See the License for the specific language governing permissions and
13   *   limitations under the License.
14   */
15  
16  package com.bea.xml.stream;
17  
18  import javax.xml.namespace.QName;
19  import javax.xml.namespace.NamespaceContext;
20  
21  import com.bea.xml.stream.util.EmptyIterator;
22  import javax.xml.stream.events.XMLEvent;
23  import javax.xml.stream.XMLStreamReader;
24  import javax.xml.stream.Location;
25  import javax.xml.stream.XMLStreamException;
26  import java.util.List;
27  import java.io.InputStream;
28  import java.io.Reader;
29  
30  /***
31   * <p> An implementation of the ReaderDelegate class </p>
32   */
33  
34  public class ReaderDelegate implements XMLStreamReader {
35    private XMLStreamReader reader;
36  
37    public ReaderDelegate(XMLStreamReader reader) {
38      this.reader = reader;
39    }
40    public void setDelegate(XMLStreamReader reader) {
41      this.reader = reader;
42    }
43    public XMLStreamReader getDelegate() {
44      return reader;
45    }
46  
47    public int next() 
48      throws XMLStreamException 
49    {
50      return reader.next();
51    }
52  
53    public int nextTag() 
54      throws XMLStreamException 
55    {
56      return reader.nextTag();
57    }
58  
59    public String getElementText() 
60      throws XMLStreamException 
61    {
62      return reader.getElementText();
63    }
64  
65    public void require(int type, String namespaceURI, String localName)  
66      throws XMLStreamException
67    {
68      reader.require(type,namespaceURI,localName);
69    }
70  
71    public boolean hasNext() 
72      throws XMLStreamException
73    {
74      return reader.hasNext();
75    }
76  
77    //public void skip() 
78    // throws XMLStreamException
79    //{
80    //  reader.skip();
81    // }
82  
83    public void close() 
84      throws XMLStreamException
85    {
86      reader.close();
87    }
88  
89    public String getNamespaceURI(String prefix) 
90    {
91      return reader.getNamespaceURI(prefix);
92    }
93  
94    public NamespaceContext getNamespaceContext() {
95      return reader.getNamespaceContext();
96    }
97  
98    public boolean isStartElement() {
99      return reader.isStartElement();
100   }
101 
102   public boolean isEndElement() {
103     return reader.isEndElement();
104   }
105 
106   public boolean isCharacters() {
107     return reader.isCharacters();
108   }
109 
110   public boolean isWhiteSpace() {
111     return reader.isWhiteSpace();
112   }
113 
114   public QName getAttributeName(int index) {
115     return reader.getAttributeName(index);
116   }
117 
118   public int getTextCharacters(int sourceStart, 
119                                char[] target, 
120                                int targetStart, 
121                                int length) 
122     throws XMLStreamException {
123     return reader.getTextCharacters(sourceStart,
124                                     target,
125                                     targetStart,
126                                     length);
127   }
128 
129   /***********8
130   public boolean moveToStartElement() 
131     throws XMLStreamException
132   {
133     return reader.moveToStartElement();
134   }
135 
136   public boolean moveToStartElement(String localName) 
137     throws XMLStreamException
138   {
139     return reader.moveToStartElement(localName);
140   }
141 
142   public boolean moveToStartElement(String localName, String namespaceUri) 
143     throws XMLStreamException
144   {
145     return reader.moveToStartElement(localName,namespaceUri);
146   }
147 
148   public boolean moveToEndElement() 
149     throws XMLStreamException
150   {
151     return reader.moveToEndElement();
152   }
153 
154   public boolean moveToEndElement(String localName) 
155     throws XMLStreamException
156   {
157     return reader.moveToEndElement(localName);
158   }
159 
160   public boolean moveToEndElement(String localName, String namespaceUri) 
161     throws XMLStreamException
162   {
163     return reader.moveToEndElement(localName,namespaceUri);
164   }
165 
166   public boolean hasAttributes() {
167     return reader.hasAttributes();
168    }
169 
170   public boolean hasNamespaces() {
171     return reader.hasNamespaces();
172   }
173   ************/
174   public String getAttributeValue(String namespaceUri,
175                                   String localName) 
176   {
177     return reader.getAttributeValue(namespaceUri,localName);
178   }
179   public int getAttributeCount() {
180     return reader.getAttributeCount();
181   }
182   public String getAttributePrefix(int index) {
183     return reader.getAttributePrefix(index);
184   }
185   public String getAttributeNamespace(int index) {
186     return reader.getAttributeNamespace(index);
187   }
188   public String getAttributeLocalName(int index) {
189     return reader.getAttributeLocalName(index);
190   }
191   public String getAttributeType(int index) {
192     return reader.getAttributeType(index);
193   }
194   public String getAttributeValue(int index) {
195     return reader.getAttributeValue(index);
196   }
197   public boolean isAttributeSpecified(int index) {
198     return reader.isAttributeSpecified(index);
199   }
200 
201   public int getNamespaceCount() {
202     return reader.getNamespaceCount();
203   }
204   public String getNamespacePrefix(int index) {
205     return reader.getNamespacePrefix(index);
206   }
207   public String getNamespaceURI(int index) {
208     return reader.getNamespaceURI(index);
209   }
210     
211 
212   // public AttributeIterator getAttributes() {
213   //  return reader.getAttributes();
214   //
215 
216   //  public NamespaceIterator getNamespaces() {
217   //  return reader.getNamespaces();
218   // }
219 
220   //  public XMLStreamReader subReader() 
221   //  throws XMLStreamException
222   // {
223   //  return reader.subReader();
224   // }
225 
226   //  public void recycle() 
227   //  throws XMLStreamException
228   // {
229   //  reader.recycle();
230   // }
231 
232   public int getEventType() {
233     return reader.getEventType();
234   }
235 
236   public String getText() {
237     return reader.getText();
238   }
239 
240   public char[] getTextCharacters() {
241     return reader.getTextCharacters();
242   }
243 
244   public int getTextStart() {
245     return reader.getTextStart();
246   }
247 
248   public int getTextLength() {
249     return reader.getTextLength();
250   }
251 
252   public String getEncoding() {
253     return reader.getEncoding();
254   }
255 
256   public boolean hasText() {
257     return reader.hasText();
258   }
259 
260   //  public int getLineNumber() {
261   //  return reader.getLineNumber();
262   // }
263 
264   //public int getColumnNumber() {
265   //  return reader.getColumnNumber();
266   // }
267 
268   //  public int getCharacterOffset() {
269   //  return reader.getCharacterOffset();
270   // }
271   public Location getLocation() {
272     return reader.getLocation();
273   }
274 
275   public QName getName() {
276     return reader.getName();
277   }
278 
279 
280   public String getLocalName() {
281     return reader.getLocalName();
282   }
283 
284   public boolean hasName() {
285     return reader.hasName();
286   }
287 
288   public String getNamespaceURI() {
289     return reader.getNamespaceURI();
290   }
291 
292   public String getPrefix() {
293     return reader.getPrefix();
294   }
295 
296   public String getVersion() {
297     return reader.getVersion();
298   }
299 
300   public boolean isStandalone() {
301     return reader.isStandalone();
302   }
303 
304   public boolean standaloneSet() {
305     return reader.standaloneSet();
306   }
307 
308   public String getCharacterEncodingScheme() {
309     return reader.getCharacterEncodingScheme();
310   }
311 
312   public String getPITarget() {
313     return reader.getPITarget();
314   }
315 
316   public String getPIData() {
317     return reader.getPIData();
318   }
319   //  public NamespaceIterator getOutOfScopeNamespaces() {
320   //  return reader.getOutOfScopeNamespaces();
321   // }
322 
323   //  public ConfigurationContext getConfigurationContext() {
324   //  return reader.getConfigurationContext();
325   // }
326 
327   public Object getProperty(String name) {
328     return reader.getProperty(name);
329   }
330 }