Package org.codehaus.stax2.ri.evt
Class Stax2FilteredEventReader
java.lang.Object
org.codehaus.stax2.ri.evt.Stax2FilteredEventReader
- All Implemented Interfaces:
Iterator<Object>,XMLEventReader,XMLStreamConstants,XMLEventReader2
Some notes about implemention:
- There is no way to filter out values of peek(), so we'll just straight dispatch the call to underlying reader
-
Field Summary
Fields inherited from interface javax.xml.stream.XMLStreamConstants
ATTRIBUTE, CDATA, CHARACTERS, COMMENT, DTD, END_DOCUMENT, END_ELEMENT, ENTITY_DECLARATION, ENTITY_REFERENCE, NAMESPACE, NOTATION_DECLARATION, PROCESSING_INSTRUCTION, SPACE, START_DOCUMENT, START_ELEMENT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()getProperty(String name) booleanhasNext()booleanMethod that is similar toXMLEventReader.hasNext(), except that it can throw aXMLStreamException.booleanisPropertySupported(String name) Method similar toXMLInputFactory.isPropertySupported(java.lang.String), used to determine whether a property is supported by the Reader instance.next()nextTag()peek()This is bit tricky to implement, but it should filter out events just as nextEvent() would.voidremove()Note: only here because we implement Iterator interfacebooleansetProperty(String name, Object value) Method that can be used to set per-reader properties; a subset of properties one can set via matchingXMLInputFactory2instance.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Iterator
forEachRemaining
-
Constructor Details
-
Stax2FilteredEventReader
-
-
Method Details
-
close
- Specified by:
closein interfaceXMLEventReader- Throws:
XMLStreamException
-
getElementText
- Specified by:
getElementTextin interfaceXMLEventReader- Throws:
XMLStreamException
-
getProperty
- Specified by:
getPropertyin interfaceXMLEventReader
-
hasNext
public boolean hasNext()- Specified by:
hasNextin interfaceIterator<Object>- Specified by:
hasNextin interfaceXMLEventReader
-
nextEvent
- Specified by:
nextEventin interfaceXMLEventReader- Throws:
XMLStreamException
-
next
-
nextTag
- Specified by:
nextTagin interfaceXMLEventReader- Throws:
XMLStreamException
-
peek
This is bit tricky to implement, but it should filter out events just as nextEvent() would.- Specified by:
peekin interfaceXMLEventReader- Throws:
XMLStreamException
-
remove
public void remove()Note: only here because we implement Iterator interface -
hasNextEvent
Description copied from interface:XMLEventReader2Method that is similar toXMLEventReader.hasNext(), except that it can throw aXMLStreamException. This is important distinction, since the underlying stream reader is NOT allowed to throw such an exception when itshasNext()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.- Specified by:
hasNextEventin interfaceXMLEventReader2- Throws:
XMLStreamException
-
isPropertySupported
Description copied from interface:XMLEventReader2Method similar toXMLInputFactory.isPropertySupported(java.lang.String), 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.- Specified by:
isPropertySupportedin interfaceXMLEventReader2
-
setProperty
Description copied from interface:XMLEventReader2Method that can be used to set per-reader properties; a subset of properties one can set via matchingXMLInputFactory2instance. Exactly which methods are mutable is implementation specific.- Specified by:
setPropertyin interfaceXMLEventReader2- Parameters:
name- Name of the property to setvalue- Value to set property to.- Returns:
- True, if the specified property was succesfully set to specified value; false if its value was not changed
-