generateEventStream function

StreamQueue<XmlEvent> generateEventStream(
  1. Stream<String> source
)

Converts a stream of Strings, such as from a file, to to a StreamQueue of XML Events ready for parsing.

The converted stream has three important features: every event contains a reference to its "parent" (enclosing) event, comments have been stripped, and runs of XML Text events have been coalesced together. The parser utilities need these three things to be true.

Implementation

StreamQueue<XmlEvent> generateEventStream(Stream<String> source) => StreamQueue(
    source.toXmlEvents().withParentEvents().normalizeEvents().flatten());