nextToken

open override fun nextToken(): EventType

This method works similarly to next() but will expose additional event types (COMMENT, CDSECT, DOCDECL, ENTITY_REF, PROCESSING_INSTRUCTION, or IGNORABLE_WHITESPACE) if they are available in input.

The returned content is end-of-line normalized as described XML 1.0 End-of-Line Handling and.

Here is the list of tokens that can be returned from nextToken() and what text returns:

  • START_DOCUMENT: ""

  • XML_DECL: ""

  • END_DOCUMENT: ""

  • START_TAG: ""

  • END_TAG:

  • TEXT: The element content. Note that element content may be delivered in multiple consecutive TEXT events.

  • IGNORABLE_WHITESPACE: Characters that are determined to be ignorable white space. Note that element content may be delevered in multiple consecutive IGNORABLE_WHITESPACE events.

  • CDSECT: The text inside CDATA (ex. 'fo)

  • PROCESSING_INSTRUCTION: PI content or concatenation of PI target, space and data.

  • COMMENT: Comment content ex. 'foo bar' from

  • ENTITY_REF: text MUST return the entity replacement

  • DOCDECL: Content of the document declaration.

NOTE: there is no guarantee that there will only one TEXT or IGNORABLE_WHITESPACE event from nextToken() as parser may chose to deliver element content in multiple tokens (dividing element content into chunks)

See also