javax.xml.stream

Interface XMLEventReader

public interface XMLEventReader extends Iterator

An XML parser.
Method Summary
voidclose()
Free any resources associated with this parser.
StringgetElementText()
Reads the text context of an element.
ObjectgetProperty(String name)
Returns the implementation-specific feature or property of the given name.
booleanhasNext()
Indicates whether there are more XML events to be read.
XMLEventnextEvent()
Returns the next XML event.
XMLEventnextTag()
Returns the next element event.
XMLEventpeek()
Looks at the next XML event without advancing the cursor in the stream.

Method Detail

close

public void close()
Free any resources associated with this parser. This method will not close the underlying input source.

getElementText

public String getElementText()
Reads the text context of an element. When invoked, the current event must be START_ELEMENT. On completion, the current event will be END_ELEMENT.

getProperty

public Object getProperty(String name)
Returns the implementation-specific feature or property of the given name.

Throws: IllegalArgumentException if the property is not supported

hasNext

public boolean hasNext()
Indicates whether there are more XML events to be read.

nextEvent

public XMLEvent nextEvent()
Returns the next XML event.

nextTag

public XMLEvent nextTag()
Returns the next element event. This method skips insignificant space until a START_ELEMENT or END_ELEMENT event is found.

Throws: XMLStreamException if an event that was not an insignificant space event was encountered

peek

public XMLEvent peek()
Looks at the next XML event without advancing the cursor in the stream. Returns null if there are no more events to read.