{@link XMLInputStreamReader} implementation thatrepresents a text node wrapped inside an element. The text data is provided by a {@link java.io.Reader Reader}.
It will produce the following sequence of XML events:
- START_DOCUMENT
- START_ELEMENT
- (CHARACTER)*
- END_ELEMENT
- END_DOCMENT
The class is implemented as a simple state machine, where the state is identified by the current event type. The initial state is
START_DOCUMENT and the following transitions are triggered by {@link #next()}:
- START_DOCUMENT → START_ELEMENT
- START_ELEMENT → END_ELEMENT (if character stream is empty)
- START_ELEMENT → CHARACTERS (if character stream is not empty)
- CHARACTERS → CHARACTERS (if data available in stream)
- CHARACTERS → END_ELEMENT (if end of stream reached)
- END_ELEMENT → END_DOCUMENT
Additionally, {@link #getElementText()} triggers the following transition:
- START_ELEMENT → END_ELEMENT
Note that since multiple consecutive CHARACTERS events may be returned, this "parser" is not coalescing.