The getText()
method returns the text of the current event:
public String getText()
Exactly what this is depends on the type of the event:
For tags, it's null, unless round-tripping is turned on, in which case it's the complete actual tag.
For entity references, it's the entity replacement text (or null if this is not available).
For text and ignorable white space, it's the actual text.
For CDATA sections, it's the text inside the CDATA section delimiters,
that is, between <![CDATA[
and ]]>
.
For start and end document, it's null.
For comments, it's the content of the comment inside the <-- and -->.
For processing instructions, it's the content of the instruction inside the <?
and ?>
.
For document type declarations, it's the content of the DOCTYPE declaration between <!DOCTYPE
and the closing >
.