Classes needed to view an XML document as a series of events. The document is parsed by an XMLEventReader instance. You can treat it as an Iterator to retrieve the events, which are all subclasses of XMLEvent.
scala> val source = Source.fromString("""<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?instruction custom value="customvalue"?> <!DOCTYPE foo [ <!ENTITY bar "BAR"> ]><foo>Hello<bar>&bar;</bar><bar>></bar></foo>""") source: scala.io.Source = non-empty iterator scala> val reader = new XMLEventReader(source) reader: scala.xml.pull.XMLEventReader = non-empty iterator scala> reader.foreach{ println(_) } EvProcInstr(instruction,custom value="customvalue") EvText( ) EvElemStart(null,foo,,) EvText(Hello) EvComment( this is a comment ) EvElemStart(null,bar,,) EvText(BAR) EvElemEnd(null,bar) EvElemStart(null,bar,,) EvEntityRef(gt) EvElemEnd(null,bar) EvElemEnd(null,foo) EvText( )
A comment was encountered
An Element's end tag was encountered.
An Element's start tag was encountered.
An entity reference was encountered.
A processing instruction was encountered.
A text node was encountered.
An XML event for pull parsing.
Main entry point into creating an event-based XML parser.
Classes needed to view an XML document as a series of events. The document is parsed by an XMLEventReader instance. You can treat it as an Iterator to retrieve the events, which are all subclasses of XMLEvent.