Top Description Fields Constructors Methods
org.hibernate.internal.util.xml

public abstract Class BaseXMLEventReader

extends EventReaderDelegate
Class Inheritance
Known Direct Subclasses
org.hibernate.internal.util.xml.BufferedXMLEventReader, org.hibernate.internal.util.xml.FilteringXMLEventReader
Imports
javax.xml.stream.XMLEventReader, .XMLStreamConstants, .XMLStreamException, javax.xml.stream.events.Characters, .EntityDeclaration, .EntityReference, .XMLEvent, javax.xml.stream.util.EventReaderDelegate

Base for XMLEventReader that implements the getElementText() and nextTag() APIs in a way that is agnostic from the rest of the XMLEventReader implementation. Both will use the subclasses internalNextEvent() as the exclusive way to read events. Note, copied from the uPortal project by permission of author. See https://github.com/Jasig/uPortal/blob/master/uportal-war/src/main/java/org/jasig/portal/xml/stream/BaseXMLEventReader.java
Author
Eric Dalquist

Field Summary

Modifier and TypeField and Description
private XMLEvent

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public final String
protected final XMLEvent

Returns:

The XMLEvent returned by the last call to internalNextEvent()
getPreviousEvent
()

protected abstract XMLEvent
internalNextEvent()

Subclass's version of nextEvent(), called by next()

public final Object
next()

Overrides javax.xml.stream.util.EventReaderDelegate.next.

Implements java.util.Iterator.next.

Returns the next element in the iteration.
public final XMLEvent
public final XMLEvent
nextTag()

Overrides javax.xml.stream.util.EventReaderDelegate.nextTag.

Implements javax.xml.stream.XMLEventReader.nextTag.

Skips any insignificant space events until a START_ELEMENT or END_ELEMENT is reached.
Inherited from javax.xml.stream.util.EventReaderDelegate:
closegetParentgetPropertyhasNextpeekremovesetParent

Field Detail

previousEventback to summary
private XMLEvent previousEvent

Constructor Detail

BaseXMLEventReaderback to summary
public BaseXMLEventReader(XMLEventReader reader)

Method Detail

getElementTextback to summary
public final String getElementText() throws XMLStreamException

Overrides javax.xml.stream.util.EventReaderDelegate.getElementText.

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
getPreviousEventback to summary
protected final XMLEvent getPreviousEvent()
Returns:XMLEvent

The XMLEvent returned by the last call to internalNextEvent()

internalNextEventback to summary
protected abstract XMLEvent internalNextEvent() throws XMLStreamException

Subclass's version of nextEvent(), called by next()

nextback to summary
public final Object next()

Overrides javax.xml.stream.util.EventReaderDelegate.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 final XMLEvent nextEvent() throws XMLStreamException

Overrides javax.xml.stream.util.EventReaderDelegate.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
Exceptions
XMLStreamException:
if there is an error with the underlying XML.
nextTagback to summary
public final XMLEvent nextTag() throws XMLStreamException

Overrides javax.xml.stream.util.EventReaderDelegate.nextTag.

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