Package com.bea.xml.stream
Class XMLEventReaderBase
- java.lang.Object
-
- 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.XMLEventConsumerThe base reader class.
-
-
Constructor Summary
Constructors Constructor Description XMLEventReaderBase(javax.xml.stream.XMLStreamReader reader)XMLEventReaderBase(javax.xml.stream.XMLStreamReader reader, javax.xml.stream.util.XMLEventAllocator alloc)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(javax.xml.stream.events.XMLEvent event)This method adds an event to the consumer.voidclose()Frees any resources associated with this Reader.protected javax.xml.stream.events.XMLEventget()java.lang.StringgetElementText()Reads the content of a text-only element.java.lang.ObjectgetProperty(java.lang.String name)Get the value of a feature/property from the underlying implementationbooleanhasNext()Check if there are more events.protected voidinternal_close()protected booleanisOpen()static voidmain(java.lang.String[] args)protected booleanneedsMore()java.lang.Objectnext()javax.xml.stream.events.XMLEventnextEvent()Get the next XMLEventjavax.xml.stream.events.XMLEventnextTag()Skips any insignificant space events until a START_ELEMENT or END_ELEMENT is reached.protected booleanparseSome()javax.xml.stream.events.XMLEventpeek()Check the next XMLEvent without reading it from the stream.voidremove()voidsetAllocator(javax.xml.stream.util.XMLEventAllocator allocator)voidsetConfigurationContext(ConfigurationContextBase base)
-
-
-
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.XMLStreamExceptionDescription copied from interface:javax.xml.stream.XMLEventReaderReads 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:
getElementTextin interfacejavax.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.XMLStreamExceptionDescription copied from interface:javax.xml.stream.XMLEventReaderSkips 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:
nextTagin interfacejavax.xml.stream.XMLEventReader- Throws:
javax.xml.stream.XMLStreamException- if anything other than space characters are encountered
-
next
public java.lang.Object next()
- Specified by:
nextin interfacejava.util.Iterator
-
nextEvent
public javax.xml.stream.events.XMLEvent nextEvent() throws javax.xml.stream.XMLStreamExceptionDescription copied from interface:javax.xml.stream.XMLEventReaderGet the next XMLEvent- Specified by:
nextEventin interfacejavax.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.XMLEventReaderCheck if there are more events. Returns true if there are more events and false otherwise.- Specified by:
hasNextin interfacejava.util.Iterator- Specified by:
hasNextin interfacejavax.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.XMLStreamExceptionDescription copied from interface:javax.xml.stream.XMLEventReaderCheck 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:
peekin interfacejavax.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.XMLStreamExceptionDescription copied from interface:javax.xml.stream.util.XMLEventConsumerThis 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:
addin interfacejavax.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.XMLStreamExceptionDescription copied from interface:javax.xml.stream.XMLEventReaderFrees any resources associated with this Reader. This method does not close the underlying input source.- Specified by:
closein interfacejavax.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.XMLEventReaderGet the value of a feature/property from the underlying implementation- Specified by:
getPropertyin interfacejavax.xml.stream.XMLEventReader- Parameters:
name- The name of the property- Returns:
- The value of the property
-
remove
public void remove()
- Specified by:
removein interfacejava.util.Iterator
-
main
public static void main(java.lang.String[] args) throws java.lang.Exception- Throws:
java.lang.Exception
-
-