Top Description Fields Constructors Methods
org.codehaus.stax2.ri.evt

public Class Stax2FilteredEventReader

extends Object
implements XMLEventReader2, XMLStreamConstants
Class Inheritance
All Implemented Interfaces
javax.xml.stream.XMLStreamConstants, org.codehaus.stax2.XMLEventReader2, javax.xml.stream.XMLEventReader, java.util.Iterator
Imports
javax.xml.stream.*, javax.xml.stream.events.*, org.codehaus.stax2.XMLEventReader2

Some notes about implemention:

Field Summary

Modifier and TypeField and Description
pack-priv final EventFilter
pack-priv final XMLEventReader2

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements javax.xml.stream.XMLEventReader.close.

Frees any resources associated with this Reader.
public String
getElementText()

Implements javax.xml.stream.XMLEventReader.getElementText.

Reads the content of a text-only element.
public Object
getProperty(String
The name of the property
name
)

Implements javax.xml.stream.XMLEventReader.getProperty.

Get the value of a feature/property from the underlying implementation
public boolean
hasNext()

Implements javax.xml.stream.XMLEventReader.hasNext.

Check if there are more events.
public boolean
hasNextEvent()

Implements org.codehaus.stax2.XMLEventReader2.hasNextEvent.

Method that is similar to hasNext, except that it can throw a XMLStreamException.
public boolean
isPropertySupported(String name)

Implements org.codehaus.stax2.XMLEventReader2.isPropertySupported.

Method similar to javax.xml.stream.XMLInputFactory#isPropertySupported, used to determine whether a property is supported by the Reader instance.
public Object
next()

Implements java.util.Iterator.next.

Returns the next element in the iteration.
public XMLEvent
nextEvent()

Implements javax.xml.stream.XMLEventReader.nextEvent.

Gets the next XMLEvent.
public XMLEvent
nextTag()

Implements javax.xml.stream.XMLEventReader.nextTag.

Skips any insignificant space events until a START_ELEMENT or END_ELEMENT is reached.
public XMLEvent
peek()

Implements javax.xml.stream.XMLEventReader.peek.

This is bit tricky to implement, but it should filter out events just as nextEvent() would.
public void
remove()

Overrides default java.util.Iterator.remove.

Note

only here because we implement Iterator interface

public boolean
setProperty(String
Name of the property to set
name
,
Object
Value to set property to.
value
)

Implements org.codehaus.stax2.XMLEventReader2.setProperty.

Method that can be used to set per-reader properties; a subset of properties one can set via matching org.codehaus.stax2.XMLInputFactory2 instance.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

mFilterback to summary
pack-priv final EventFilter mFilter
mReaderback to summary
pack-priv final XMLEventReader2 mReader

Constructor Detail

Stax2FilteredEventReaderback to summary
public Stax2FilteredEventReader(XMLEventReader2 r, EventFilter f)

Method Detail

closeback to summary
public void close() throws XMLStreamException

Implements javax.xml.stream.XMLEventReader.close.

Doc from javax.xml.stream.XMLEventReader.close.

Frees any resources associated with this Reader. This method does not close the underlying input source.

Annotations
@Override
Exceptions
XMLStreamException:
if there are errors freeing associated resources
getElementTextback to summary
public String getElementText() throws XMLStreamException

Implements javax.xml.stream.XMLEventReader.getElementText.

Doc from javax.xml.stream.XMLEventReader.getElementText.

Reads the content of a text-only element. Precondition: the current event is START_ELEMENT. Postcondition: The current event is the corresponding END_ELEMENT.

Returns:String

the text of the element

Annotations
@Override
Exceptions
XMLStreamException:
if the current event is not a START_ELEMENT or if a non text element is encountered
getPropertyback to summary
public Object getProperty(String name)

Implements javax.xml.stream.XMLEventReader.getProperty.

Doc from javax.xml.stream.XMLEventReader.getProperty.

Get the value of a feature/property from the underlying implementation

Parameters
name:String

The name of the property

Returns:Object

The value of the property

Annotations
@Override
hasNextback to summary
public boolean hasNext()

Implements javax.xml.stream.XMLEventReader.hasNext.

Doc from javax.xml.stream.XMLEventReader.hasNext.

Check if there are more events. Returns true if there are more events and false otherwise.

Returns:boolean

true if the event reader has more events, false otherwise

Annotations
@Override
hasNextEventback to summary
public boolean hasNextEvent() throws XMLStreamException

Implements org.codehaus.stax2.XMLEventReader2.hasNextEvent.

Doc from org.codehaus.stax2.XMLEventReader2.hasNextEvent.

Method that is similar to hasNext, except that it can throw a XMLStreamException. This is important distinction, since the underlying stream reader is NOT allowed to throw such an exception when its hasNext() gets called; but the underlying parser may well need to advance the input stream and in doing so may encounter an exception. This exception should be propagated to the caller, as it may signal a problem with the input stream or xml content.

Annotations
@Override
isPropertySupportedback to summary
public boolean isPropertySupported(String name)

Implements org.codehaus.stax2.XMLEventReader2.isPropertySupported.

Doc from org.codehaus.stax2.XMLEventReader2.isPropertySupported.

Method similar to javax.xml.stream.XMLInputFactory#isPropertySupported, used to determine whether a property is supported by the Reader instance. This means that this method may return false for some properties that the input factory does support: specifically, it should only return true if the value is mutable on per-instance basis. False means that either the property is not recognized, or is not mutable via reader instance.

Annotations
@Override
nextback to summary
public Object next()

Implements java.util.Iterator.next.

Doc from java.util.Iterator.next.

Returns the next element in the iteration.

Returns:Object

the next element in the iteration

Annotations
@Override
nextEventback to summary
public XMLEvent nextEvent() throws XMLStreamException

Implements javax.xml.stream.XMLEventReader.nextEvent.

Doc from javax.xml.stream.XMLEventReader.nextEvent.

Gets the next XMLEvent. The initial event is StartDocument.

Returns:XMLEvent

the next XMLEvent

Annotations
@Override
Exceptions
XMLStreamException:
if there is an error with the underlying XML.
nextTagback to summary
public XMLEvent nextTag() throws XMLStreamException

Implements javax.xml.stream.XMLEventReader.nextTag.

Doc from javax.xml.stream.XMLEventReader.nextTag.

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.

Returns:XMLEvent

a START_ELEMENT or END_ELEMENT

Annotations
@Override
Exceptions
XMLStreamException:
if anything other than space characters are encountered
peekback to summary
public XMLEvent peek() throws XMLStreamException

Implements javax.xml.stream.XMLEventReader.peek.

This is bit tricky to implement, but it should filter out events just as nextEvent() would.

Returns:XMLEvent

Doc from javax.xml.stream.XMLEventReader.peek.

the next XMLEvent

Annotations
@Override
Exceptions
XMLStreamException:

Doc from javax.xml.stream.XMLEventReader.peek.

if an error occurs

removeback to summary
public void remove()

Overrides default java.util.Iterator.remove.

Note

only here because we implement Iterator interface

Annotations
@Override
setPropertyback to summary
public boolean setProperty(String name, Object value)

Implements org.codehaus.stax2.XMLEventReader2.setProperty.

Doc from org.codehaus.stax2.XMLEventReader2.setProperty.

Method that can be used to set per-reader properties; a subset of properties one can set via matching org.codehaus.stax2.XMLInputFactory2 instance. Exactly which methods are mutable is implementation specific.

Parameters
name:String

Name of the property to set

value:Object

Value to set property to.

Returns:boolean

True, if the specified property was succesfully set to specified value; false if its value was not changed

Annotations
@Override