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 void
close()
Frees any resources associated with this Reader.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 implementationboolean
hasNext()
Check if there are more events.static void
main(java.lang.String[] args)
java.lang.Object
next()
javax.xml.stream.events.XMLEvent
nextEvent()
Get the next XMLEventjavax.xml.stream.events.XMLEvent
nextTag()
Skips any insignificant space events until a START_ELEMENT or END_ELEMENT is reached.javax.xml.stream.events.XMLEvent
peek()
Check the next XMLEvent without reading it from the stream.void
remove()
void
setFilter(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:
next
in interfacejava.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 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.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 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.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 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.XMLEventReader
Check if there are more events. Returns true if there are more events and false otherwise.- Specified by:
hasNext
in interfacejava.util.Iterator
- Specified by:
hasNext
in interfacejavax.xml.stream.XMLEventReader
- Returns:
- true if the event reader has more events, false otherwise
-
remove
public void remove()
- Specified by:
remove
in interfacejava.util.Iterator
-
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 interfacejavax.xml.stream.XMLEventReader
- Throws:
javax.xml.stream.XMLStreamException
- See Also:
XMLEvent
-
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 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.XMLEventReader
Get the value of a feature/property from the underlying implementation- Specified by:
getProperty
in 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
-
-