1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
package scala
package xml
/**
* Classes needed to view an XML document as a series of events. The document
* is parsed by an [[scala.xml.pull.XMLEventReader]] instance. You can treat it as
* an [[scala.collection.Iterator]] to retrieve the events, which are all
* subclasses of [[scala.xml.pull.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<!-- this is a comment --><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(
*
* )
*
* }}}
*/
package object pull
|