Top Description Fields Constructors Methods
org.springframework.util.xml

pack-priv Class ListBasedXMLEventReader

extends AbstractXMLEventReader
Class Inheritance
Imports
java.util.ArrayList, .List, .NoSuchElementException, javax.xml.stream.XMLStreamConstants, .XMLStreamException, javax.xml.stream.events.Characters, .XMLEvent, org.springframework.lang.Nullable, org.springframework.util.Assert

Implementation of XMLEventReader based on a List of XMLEvent elements.
Authors
Arjen Poutsma, Juergen Hoeller
Since
5.0

Field Summary

Modifier and TypeField and Description
private XMLEvent
private int
private final List<XMLEvent>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
close()

Overrides org.springframework.util.xml.AbstractXMLEventReader.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 boolean
hasNext()

Implements javax.xml.stream.XMLEventReader.hasNext.

Check if there are more events.

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.

Check the next XMLEvent without reading it from the stream.

Inherited from org.springframework.util.xml.AbstractXMLEventReader:
checkIfClosedgetPropertynextremove

Field Detail

currentEventback to summary
private XMLEvent currentEvent
Annotations
@Nullable
cursorback to summary
private int cursor
eventsback to summary
private final List<XMLEvent> events

Constructor Detail

ListBasedXMLEventReaderback to summary
public ListBasedXMLEventReader(List<XMLEvent> events)

Method Detail

closeback to summary
public void close()

Overrides org.springframework.util.xml.AbstractXMLEventReader.close.

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
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
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
nextEventback to summary
public XMLEvent nextEvent()

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
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
@Nullable
Exceptions
XMLStreamException:
if anything other than space characters are encountered
peekback to summary
public XMLEvent peek()

Implements javax.xml.stream.XMLEventReader.peek.

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

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().

Returns:XMLEvent

the next XMLEvent

Annotations
@Override
@Nullable