|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.xml.stream.util.EventReaderDelegate
org.dellroad.stuff.xml.AnnotatedXMLEventReader
public abstract class AnnotatedXMLEventReader
XMLEventReader that reads and removes an initial annotation element from an XML document.
The annotation element, if present, must be the first element inside the top-level document element.
When the annotation element is encountered, readAnnotationElement() will be invoked.
This class can be used in combination with AnnotatedXMLEventWriter to transparently annotate XML documents.
AnnotatedXMLEventWriter| Constructor Summary | |
|---|---|
AnnotatedXMLEventReader(XMLEventReader inner)
Constructor. |
|
| Method Summary | |
|---|---|
protected XMLEvent |
advance()
Advance one event in the event stream. |
protected abstract boolean |
isAnnotationElement(StartElement event)
Determine if the given event represents the start of the annotation element. |
Object |
next()
|
XMLEvent |
nextEvent()
|
XMLEvent |
peek()
|
protected abstract void |
readAnnotationElement(StartElement event)
Read the annotation element. |
void |
setParent(XMLEventReader reader)
|
protected XMLEvent |
skipWhiteSpace(XMLEvent event,
boolean comments)
Skip whitespace. |
| Methods inherited from class javax.xml.stream.util.EventReaderDelegate |
|---|
close, getElementText, getParent, getProperty, hasNext, nextTag, remove |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AnnotatedXMLEventReader(XMLEventReader inner)
The given parameter should expect to read the XML document without the annotation element.
inner - nested reader| Method Detail |
|---|
public void setParent(XMLEventReader reader)
setParent in class EventReaderDelegatepublic Object next()
next in interface Iteratornext in class EventReaderDelegate
public XMLEvent peek()
throws XMLStreamException
peek in interface XMLEventReaderpeek in class EventReaderDelegateXMLStreamException
public XMLEvent nextEvent()
throws XMLStreamException
nextEvent in interface XMLEventReadernextEvent in class EventReaderDelegateXMLStreamExceptionprotected abstract boolean isAnnotationElement(StartElement event)
protected abstract void readAnnotationElement(StartElement event)
throws XMLStreamException
When this method is invoked, event represents the StartElement event for the annotation element
(i.e., isAnnotationElement(event) has returned true); it is also the next event in the
pipeline, i.e., the next event returned by nextEvent().
The last event consumed by this method should be the EndElement event for the
annotation element, and the event returned by peek() should be the next event after the
EndElement.
event - the StartElement event for the annotation element
XMLStreamException
protected XMLEvent skipWhiteSpace(XMLEvent event,
boolean comments)
throws XMLStreamException
event - the next event, as returned by peek()comments - whether to also skip comments
peek(), after skipping any leading whitespace (and, optionally, comments)
XMLStreamException
protected XMLEvent advance()
throws XMLStreamException
peek(), after the advance
XMLStreamException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||