Package com.bea.xml.stream
Class EventReaderFilter
- java.lang.Object
-
- com.bea.xml.stream.EventReaderFilter
-
- All Implemented Interfaces:
java.util.Iterator,javax.xml.stream.XMLEventReader
public class EventReaderFilter extends java.lang.Object implements javax.xml.stream.XMLEventReader
-
-
Constructor Summary
Constructors Constructor Description EventReaderFilter(javax.xml.stream.XMLEventReader reader)EventReaderFilter(javax.xml.stream.XMLEventReader reader, javax.xml.stream.EventFilter filter)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Frees any resources associated with this Reader.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.static voidmain(java.lang.String[] args)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.javax.xml.stream.events.XMLEventpeek()Check the next XMLEvent without reading it from the stream.voidremove()voidsetFilter(javax.xml.stream.EventFilter filter)
-
-
-
Constructor Detail
-
EventReaderFilter
public EventReaderFilter(javax.xml.stream.XMLEventReader reader) throws javax.xml.stream.XMLStreamException- Throws:
javax.xml.stream.XMLStreamException
-
EventReaderFilter
public EventReaderFilter(javax.xml.stream.XMLEventReader reader, javax.xml.stream.EventFilter filter) throws javax.xml.stream.XMLStreamException- Throws:
javax.xml.stream.XMLStreamException
-
-
Method Detail
-
setFilter
public void setFilter(javax.xml.stream.EventFilter filter)
-
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
-
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
-
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
-
remove
public void remove()
- Specified by:
removein interfacejava.util.Iterator
-
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
-
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
-
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
-
main
public static void main(java.lang.String[] args) throws java.lang.Exception- Throws:
java.lang.Exception
-
-