Class StackXMLEventReader

java.lang.Object
javax.xml.stream.util.EventReaderDelegate
org.dellroad.stuff.xml.StackXMLEventReader
All Implemented Interfaces:
Iterator<Object>, XMLEventReader

public class StackXMLEventReader extends EventReaderDelegate
Wrapper for a XMLEventReader that keeps track of the current element(s) being parsed as a stack of StartElement events.

Each time a StartElement is read from the underlying XMLEventReader, it is pushed onto the stack; each time a EndElement is read from the underlying XMLEventReader, the previously push StartElement is popped off.

Invocations of EventReaderDelegate.peek() do not affect the element stack.

If an XMLStreamException is thrown at any point, the element stack is no longer guaranteed to track properly.