com.bea.xml.stream
Class XMLEventReaderBase

java.lang.Object
  extended by com.bea.xml.stream.XMLEventReaderBase
All Implemented Interfaces:
java.util.Iterator, javax.xml.stream.util.XMLEventConsumer, javax.xml.stream.XMLEventReader
Direct Known Subclasses:
XMLEventPlayer

public class XMLEventReaderBase
extends java.lang.Object
implements javax.xml.stream.XMLEventReader, javax.xml.stream.util.XMLEventConsumer

The base reader class.


Field Summary
protected  javax.xml.stream.util.XMLEventAllocator allocator
           
protected  javax.xml.stream.XMLStreamReader reader
           
 
Constructor Summary
XMLEventReaderBase(javax.xml.stream.XMLStreamReader reader)
           
XMLEventReaderBase(javax.xml.stream.XMLStreamReader reader, javax.xml.stream.util.XMLEventAllocator alloc)
           
 
Method Summary
 void add(javax.xml.stream.events.XMLEvent event)
          This method adds an event to the consumer.
 void close()
          Frees any resources associated with this Reader.
protected  javax.xml.stream.events.XMLEvent get()
           
 java.lang.String getElementText()
          Reads the content of a text-only element.
 java.lang.Object getProperty(java.lang.String name)
          Get the value of a feature/property from the underlying implementation
 boolean hasNext()
          Check if there are more events.
protected  void internal_close()
           
protected  boolean isOpen()
           
static void main(java.lang.String[] args)
           
protected  boolean needsMore()
           
 java.lang.Object next()
           
 javax.xml.stream.events.XMLEvent nextEvent()
          Get the next XMLEvent
 javax.xml.stream.events.XMLEvent nextTag()
          Skips any insignificant space events until a START_ELEMENT or END_ELEMENT is reached.
protected  boolean parseSome()
           
 javax.xml.stream.events.XMLEvent peek()
          Check the next XMLEvent without reading it from the stream.
 void remove()
           
 void setAllocator(javax.xml.stream.util.XMLEventAllocator allocator)
           
 void setConfigurationContext(ConfigurationContextBase base)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

reader

protected javax.xml.stream.XMLStreamReader reader

allocator

protected javax.xml.stream.util.XMLEventAllocator allocator
Constructor Detail

XMLEventReaderBase

public XMLEventReaderBase(javax.xml.stream.XMLStreamReader reader)
                   throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

XMLEventReaderBase

public XMLEventReaderBase(javax.xml.stream.XMLStreamReader reader,
                          javax.xml.stream.util.XMLEventAllocator alloc)
                   throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException
Method Detail

setAllocator

public void setAllocator(javax.xml.stream.util.XMLEventAllocator allocator)

getElementText

public java.lang.String getElementText()
                                throws javax.xml.stream.XMLStreamException
Description copied from interface: javax.xml.stream.XMLEventReader
Reads the content of a text-only element. Precondition: the current event is START_ELEMENT. Postcondition: The current event is the corresponding END_ELEMENT.

Specified by:
getElementText in interface javax.xml.stream.XMLEventReader
Throws:
javax.xml.stream.XMLStreamException - if the current event is not a START_ELEMENT or if a non text element is encountered

nextTag

public javax.xml.stream.events.XMLEvent nextTag()
                                         throws javax.xml.stream.XMLStreamException
Description copied from interface: javax.xml.stream.XMLEventReader
Skips any insignificant space events until a START_ELEMENT or END_ELEMENT is reached. If anything other than space characters are encountered, an exception is thrown. This method should be used when processing element-only content because the parser is not able to recognize ignorable whitespace if the DTD is missing or not interpreted.

Specified by:
nextTag in interface javax.xml.stream.XMLEventReader
Throws:
javax.xml.stream.XMLStreamException - if anything other than space characters are encountered

next

public java.lang.Object next()
Specified by:
next in interface java.util.Iterator

nextEvent

public javax.xml.stream.events.XMLEvent nextEvent()
                                           throws javax.xml.stream.XMLStreamException
Description copied from interface: javax.xml.stream.XMLEventReader
Get the next XMLEvent

Specified by:
nextEvent in interface javax.xml.stream.XMLEventReader
Throws:
javax.xml.stream.XMLStreamException - if there is an error with the underlying XML.
See Also:
XMLEvent

hasNext

public boolean hasNext()
Description copied from interface: javax.xml.stream.XMLEventReader
Check if there are more events. Returns true if there are more events and false otherwise.

Specified by:
hasNext in interface java.util.Iterator
Specified by:
hasNext in interface javax.xml.stream.XMLEventReader
Returns:
true if the event reader has more events, false otherwise

peek

public javax.xml.stream.events.XMLEvent peek()
                                      throws javax.xml.stream.XMLStreamException
Description copied from interface: javax.xml.stream.XMLEventReader
Check the next XMLEvent without reading it from the stream. Returns null if the stream is at EOF or has no more XMLEvents. A call to peek() will be equal to the next return of next().

Specified by:
peek in interface javax.xml.stream.XMLEventReader
Throws:
javax.xml.stream.XMLStreamException
See Also:
XMLEvent

add

public void add(javax.xml.stream.events.XMLEvent event)
         throws javax.xml.stream.XMLStreamException
Description copied from interface: javax.xml.stream.util.XMLEventConsumer
This method adds an event to the consumer. Calling this method invalidates the event parameter. The client application should discard all references to this event upon calling add. The behavior of an application that continues to use such references is undefined.

Specified by:
add in interface javax.xml.stream.util.XMLEventConsumer
Parameters:
event - the event to add, may not be null
Throws:
javax.xml.stream.XMLStreamException

needsMore

protected boolean needsMore()

get

protected javax.xml.stream.events.XMLEvent get()
                                        throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

isOpen

protected boolean isOpen()

internal_close

protected void internal_close()

close

public void close()
           throws javax.xml.stream.XMLStreamException
Description copied from interface: javax.xml.stream.XMLEventReader
Frees any resources associated with this Reader. This method does not close the underlying input source.

Specified by:
close in interface javax.xml.stream.XMLEventReader
Throws:
javax.xml.stream.XMLStreamException - if there are errors freeing associated resources

parseSome

protected boolean parseSome()
                     throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

setConfigurationContext

public void setConfigurationContext(ConfigurationContextBase base)

getProperty

public java.lang.Object getProperty(java.lang.String name)
Description copied from interface: javax.xml.stream.XMLEventReader
Get the value of a feature/property from the underlying implementation

Specified by:
getProperty in interface javax.xml.stream.XMLEventReader
Parameters:
name - The name of the property
Returns:
The value of the property

remove

public void remove()
Specified by:
remove in interface java.util.Iterator

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Throws:
java.lang.Exception