Packages

  • package root
    Definition Classes
    root
  • package scala
    Definition Classes
    root
  • package xml

    This library provides support for the XML literal syntax in Scala programs.

    This library provides support for the XML literal syntax in Scala programs.

    val planets: scala.xml.Elem = <planets>
      <planet id="earth">
        <title>Earth</title>
        <mass unit="kg">5.9742e24</mass>
        <radius unit="m">6378.14e3</radius>
      </planet>
      <planet id="mars">
        <title>Mars</title>
        <mass unit="kg">0.64191e24</mass>
        <radius unit="m">3397.0e3</radius>
      </planet>
    </planets>

    Additionally, you can mix Scala expressions in your XML elements by using the curly brace notation:

    val sunMass = 1.99e30
    val sunRadius = 6.96e8
    val star = <star>
      <title>Sun</title>
      <mass unit="kg">{ sunMass }</mass>
      <radius unit="m">{ sunRadius }</radius>
      <surface unit="m²">{ 4 * Math.PI * Math.pow(sunRadius, 2) }</surface>
      <volume unit="m³">{ 4/3 * Math.PI * Math.pow(sunRadius, 3) }</volume>
    </star>

    An XML element, for example <star/> and <planet/>, is represented in this library as a case class, scala.xml.Elem.

    The sub-elements of XML values share a common base class, scala.xml.Node.

    However, the non-element declarations found in XML files share a different common base class, scala.xml.dtd.Decl. Additionally, document type declarations are represented by a different trait, scala.xml.dtd.DTD.

    For reading and writing XML data to and from files, see scala.xml.XML. The default parser of XML data is the Xerces parser and is provided in Java by javax.xml.parsers.SAXParser.

    A less greedy XML reader can return data as a sequential collection of events, see scala.xml.pull.XMLEventReader.

    For more control of the input, use the parser written in Scala that is provided, scala.xml.parsing.ConstructingParser.

    For working with XHTML input, use scala.xml.parsing.XhtmlParser.

    For more control of the output, use the scala.xml.PrettyPrinter.

    Utility methods for working with XML data are provided in scala.xml.Utility.

    XML values in Scala are immutable, but you can traverse and transform XML data with a scala.xml.transform.RuleTransformer.

    Definition Classes
    scala
  • package pull

    Classes needed to view an XML document as a series of events.

    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("""1.0" encoding="UTF-8" standalone="yes"?>
    customvalue"?>
    BAR">
    ]>Hello&bar;>""")
    
    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(
    
    )
    Definition Classes
    xml
  • EvComment
  • EvElemEnd
  • EvElemStart
  • EvEntityRef
  • EvProcInstr
  • EvText
  • ProducerConsumerIterator
  • XMLEvent
  • XMLEventReader
c

scala.xml.pull

XMLEventReader

class XMLEventReader extends AbstractIterator[XMLEvent] with ProducerConsumerIterator[XMLEvent]

Main entry point into creating an event-based XML parser. Treating this as a scala.collection.Iterator will provide access to the generated events.

Annotations
@deprecated
Deprecated

(Since version 1.1.1) Consider javax.xml.stream.XMLEventReader instead.

Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. XMLEventReader
  2. ProducerConsumerIterator
  3. AbstractIterator
  4. Iterator
  5. TraversableOnce
  6. GenTraversableOnce
  7. AnyRef
  8. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new XMLEventReader(src: Source)

    src

    A scala.io.Source for XML data to parse

Type Members

  1. class GroupedIterator[B >: A] extends AbstractIterator[collection.Seq[B]] with collection.Iterator[collection.Seq[B]]
    Definition Classes
    Iterator

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. def ++[B >: XMLEvent](that: ⇒ GenTraversableOnce[B]): collection.Iterator[B]
    Definition Classes
    Iterator
  4. def /:[B](z: B)(op: (B, XMLEvent) ⇒ B): B
    Definition Classes
    TraversableOnce → GenTraversableOnce
  5. def :\[B](z: B)(op: (XMLEvent, B) ⇒ B): B
    Definition Classes
    TraversableOnce → GenTraversableOnce
  6. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  7. val EndOfStream: POISON.type
  8. val MaxQueueSize: Int
  9. def addString(b: StringBuilder): StringBuilder
    Definition Classes
    TraversableOnce
  10. def addString(b: StringBuilder, sep: String): StringBuilder
    Definition Classes
    TraversableOnce
  11. def addString(b: StringBuilder, start: String, sep: String, end: String): StringBuilder
    Definition Classes
    TraversableOnce
  12. def aggregate[B](z: ⇒ B)(seqop: (B, XMLEvent) ⇒ B, combop: (B, B) ⇒ B): B
    Definition Classes
    TraversableOnce → GenTraversableOnce
  13. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  14. def available(): Boolean
    Definition Classes
    ProducerConsumerIterator
  15. def buffered: collection.BufferedIterator[XMLEvent]
    Definition Classes
    Iterator
  16. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  17. def collect[B](pf: PartialFunction[XMLEvent, B]): collection.Iterator[B]
    Definition Classes
    Iterator
    Annotations
    @migration
    Migration

    (Changed in version 2.8.0) collect has changed. The previous behavior can be reproduced with toSeq.

  18. def collectFirst[B](pf: PartialFunction[XMLEvent, B]): Option[B]
    Definition Classes
    TraversableOnce
  19. def contains(elem: Any): Boolean
    Definition Classes
    Iterator
  20. def copyToArray[B >: XMLEvent](xs: Array[B], start: Int, len: Int): Unit
    Definition Classes
    Iterator → TraversableOnce → GenTraversableOnce
  21. def copyToArray[B >: XMLEvent](xs: Array[B]): Unit
    Definition Classes
    TraversableOnce → GenTraversableOnce
  22. def copyToArray[B >: XMLEvent](xs: Array[B], start: Int): Unit
    Definition Classes
    TraversableOnce → GenTraversableOnce
  23. def copyToBuffer[B >: XMLEvent](dest: Buffer[B]): Unit
    Definition Classes
    TraversableOnce
  24. def corresponds[B](that: GenTraversableOnce[B])(p: (XMLEvent, B) ⇒ Boolean): Boolean
    Definition Classes
    Iterator
  25. def count(p: (XMLEvent) ⇒ Boolean): Int
    Definition Classes
    TraversableOnce → GenTraversableOnce
  26. def drop(n: Int): collection.Iterator[XMLEvent]
    Definition Classes
    Iterator
  27. def dropWhile(p: (XMLEvent) ⇒ Boolean): collection.Iterator[XMLEvent]
    Definition Classes
    Iterator
  28. def duplicate: (collection.Iterator[XMLEvent], collection.Iterator[XMLEvent])
    Definition Classes
    Iterator
  29. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  30. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  31. def exists(p: (XMLEvent) ⇒ Boolean): Boolean
    Definition Classes
    Iterator → TraversableOnce → GenTraversableOnce
  32. def filter(p: (XMLEvent) ⇒ Boolean): collection.Iterator[XMLEvent]
    Definition Classes
    Iterator
  33. def filterNot(p: (XMLEvent) ⇒ Boolean): collection.Iterator[XMLEvent]
    Definition Classes
    Iterator
  34. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  35. def find(p: (XMLEvent) ⇒ Boolean): Option[XMLEvent]
    Definition Classes
    Iterator → TraversableOnce → GenTraversableOnce
  36. def flatMap[B](f: (XMLEvent) ⇒ GenTraversableOnce[B]): collection.Iterator[B]
    Definition Classes
    Iterator
  37. def fold[A1 >: XMLEvent](z: A1)(op: (A1, A1) ⇒ A1): A1
    Definition Classes
    TraversableOnce → GenTraversableOnce
  38. def foldLeft[B](z: B)(op: (B, XMLEvent) ⇒ B): B
    Definition Classes
    TraversableOnce → GenTraversableOnce
  39. def foldRight[B](z: B)(op: (XMLEvent, B) ⇒ B): B
    Definition Classes
    TraversableOnce → GenTraversableOnce
  40. def forall(p: (XMLEvent) ⇒ Boolean): Boolean
    Definition Classes
    Iterator → TraversableOnce → GenTraversableOnce
  41. def foreach[U](f: (XMLEvent) ⇒ U): Unit
    Definition Classes
    Iterator → TraversableOnce → GenTraversableOnce
  42. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  43. def grouped[B >: XMLEvent](size: Int): GroupedIterator[B]
    Definition Classes
    Iterator
  44. def hasDefiniteSize: Boolean
    Definition Classes
    Iterator → TraversableOnce → GenTraversableOnce
  45. def hasNext: Boolean
    Definition Classes
    ProducerConsumerIterator → Iterator
  46. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  47. def indexOf[B >: XMLEvent](elem: B, from: Int): Int
    Definition Classes
    Iterator
  48. def indexOf[B >: XMLEvent](elem: B): Int
    Definition Classes
    Iterator
  49. def indexWhere(p: (XMLEvent) ⇒ Boolean, from: Int): Int
    Definition Classes
    Iterator
  50. def indexWhere(p: (XMLEvent) ⇒ Boolean): Int
    Definition Classes
    Iterator
  51. def interruptibly[A](body: ⇒ A): Option[A]
    Definition Classes
    ProducerConsumerIterator
  52. def isEmpty: Boolean
    Definition Classes
    Iterator → TraversableOnce → GenTraversableOnce
  53. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  54. def isTraversableAgain: Boolean
    Definition Classes
    Iterator → GenTraversableOnce
  55. def length: Int
    Definition Classes
    Iterator
  56. def map[B](f: (XMLEvent) ⇒ B): collection.Iterator[B]
    Definition Classes
    Iterator
  57. def max[B >: XMLEvent](implicit cmp: Ordering[B]): XMLEvent
    Definition Classes
    TraversableOnce → GenTraversableOnce
  58. def maxBy[B](f: (XMLEvent) ⇒ B)(implicit cmp: Ordering[B]): XMLEvent
    Definition Classes
    TraversableOnce → GenTraversableOnce
  59. def min[B >: XMLEvent](implicit cmp: Ordering[B]): XMLEvent
    Definition Classes
    TraversableOnce → GenTraversableOnce
  60. def minBy[B](f: (XMLEvent) ⇒ B)(implicit cmp: Ordering[B]): XMLEvent
    Definition Classes
    TraversableOnce → GenTraversableOnce
  61. def mkString: String
    Definition Classes
    TraversableOnce → GenTraversableOnce
  62. def mkString(sep: String): String
    Definition Classes
    TraversableOnce → GenTraversableOnce
  63. def mkString(start: String, sep: String, end: String): String
    Definition Classes
    TraversableOnce → GenTraversableOnce
  64. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  65. def next(): XMLEvent
    Definition Classes
    ProducerConsumerIterator → Iterator
  66. def nonEmpty: Boolean
    Definition Classes
    TraversableOnce → GenTraversableOnce
  67. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  68. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  69. def padTo[A1 >: XMLEvent](len: Int, elem: A1): collection.Iterator[A1]
    Definition Classes
    Iterator
  70. def partition(p: (XMLEvent) ⇒ Boolean): (collection.Iterator[XMLEvent], collection.Iterator[XMLEvent])
    Definition Classes
    Iterator
  71. def patch[B >: XMLEvent](from: Int, patchElems: collection.Iterator[B], replaced: Int): collection.Iterator[B]
    Definition Classes
    Iterator
  72. val preserveWS: Boolean
  73. def produce(x: XMLEvent): Unit
    Definition Classes
    ProducerConsumerIterator
  74. def product[B >: XMLEvent](implicit num: Numeric[B]): B
    Definition Classes
    TraversableOnce → GenTraversableOnce
  75. def reduce[A1 >: XMLEvent](op: (A1, A1) ⇒ A1): A1
    Definition Classes
    TraversableOnce → GenTraversableOnce
  76. def reduceLeft[B >: XMLEvent](op: (B, XMLEvent) ⇒ B): B
    Definition Classes
    TraversableOnce
  77. def reduceLeftOption[B >: XMLEvent](op: (B, XMLEvent) ⇒ B): Option[B]
    Definition Classes
    TraversableOnce → GenTraversableOnce
  78. def reduceOption[A1 >: XMLEvent](op: (A1, A1) ⇒ A1): Option[A1]
    Definition Classes
    TraversableOnce → GenTraversableOnce
  79. def reduceRight[B >: XMLEvent](op: (XMLEvent, B) ⇒ B): B
    Definition Classes
    TraversableOnce → GenTraversableOnce
  80. def reduceRightOption[B >: XMLEvent](op: (XMLEvent, B) ⇒ B): Option[B]
    Definition Classes
    TraversableOnce → GenTraversableOnce
  81. def reversed: List[XMLEvent]
    Attributes
    protected[this]
    Definition Classes
    TraversableOnce
  82. def sameElements(that: collection.Iterator[_]): Boolean
    Definition Classes
    Iterator
  83. def scanLeft[B](z: B)(op: (B, XMLEvent) ⇒ B): collection.Iterator[B]
    Definition Classes
    Iterator
  84. def scanRight[B](z: B)(op: (XMLEvent, B) ⇒ B): collection.Iterator[B]
    Definition Classes
    Iterator
  85. def seq: collection.Iterator[XMLEvent]
    Definition Classes
    Iterator → TraversableOnce → GenTraversableOnce
  86. def size: Int
    Definition Classes
    TraversableOnce → GenTraversableOnce
  87. def sizeHintIfCheap: Int
    Attributes
    protected[scala.collection]
    Definition Classes
    GenTraversableOnce
  88. def slice(from: Int, until: Int): collection.Iterator[XMLEvent]
    Definition Classes
    Iterator
  89. def sliceIterator(from: Int, until: Int): collection.Iterator[XMLEvent]
    Attributes
    protected
    Definition Classes
    Iterator
  90. def sliding[B >: XMLEvent](size: Int, step: Int): GroupedIterator[B]
    Definition Classes
    Iterator
  91. def span(p: (XMLEvent) ⇒ Boolean): (collection.Iterator[XMLEvent], collection.Iterator[XMLEvent])
    Definition Classes
    Iterator
  92. def stop(): Unit
  93. def sum[B >: XMLEvent](implicit num: Numeric[B]): B
    Definition Classes
    TraversableOnce → GenTraversableOnce
  94. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  95. def take(n: Int): collection.Iterator[XMLEvent]
    Definition Classes
    Iterator
  96. def takeWhile(p: (XMLEvent) ⇒ Boolean): collection.Iterator[XMLEvent]
    Definition Classes
    Iterator
  97. def to[Col[_]](implicit cbf: CanBuildFrom[Nothing, XMLEvent, Col[XMLEvent]]): Col[XMLEvent]
    Definition Classes
    TraversableOnce → GenTraversableOnce
  98. def toArray[B >: XMLEvent](implicit arg0: ClassTag[B]): Array[B]
    Definition Classes
    TraversableOnce → GenTraversableOnce
  99. def toBuffer[B >: XMLEvent]: Buffer[B]
    Definition Classes
    TraversableOnce → GenTraversableOnce
  100. def toIndexedSeq: collection.immutable.IndexedSeq[XMLEvent]
    Definition Classes
    TraversableOnce → GenTraversableOnce
  101. def toIterable: collection.Iterable[XMLEvent]
    Definition Classes
    TraversableOnce → GenTraversableOnce
  102. def toIterator: collection.Iterator[XMLEvent]
    Definition Classes
    Iterator → GenTraversableOnce
  103. def toList: List[XMLEvent]
    Definition Classes
    TraversableOnce → GenTraversableOnce
  104. def toMap[T, U](implicit ev: <:<[XMLEvent, (T, U)]): Map[T, U]
    Definition Classes
    TraversableOnce → GenTraversableOnce
  105. def toSeq: collection.Seq[XMLEvent]
    Definition Classes
    TraversableOnce → GenTraversableOnce
  106. def toSet[B >: XMLEvent]: Set[B]
    Definition Classes
    TraversableOnce → GenTraversableOnce
  107. def toStream: collection.immutable.Stream[XMLEvent]
    Definition Classes
    Iterator → GenTraversableOnce
  108. def toString(): String
    Definition Classes
    Iterator → AnyRef → Any
  109. def toTraversable: collection.Traversable[XMLEvent]
    Definition Classes
    Iterator → TraversableOnce → GenTraversableOnce
  110. def toVector: Vector[XMLEvent]
    Definition Classes
    TraversableOnce → GenTraversableOnce
  111. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  112. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  113. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  114. def withFilter(p: (XMLEvent) ⇒ Boolean): collection.Iterator[XMLEvent]
    Definition Classes
    Iterator
  115. def zip[B](that: collection.Iterator[B]): collection.Iterator[(XMLEvent, B)]
    Definition Classes
    Iterator
  116. def zipAll[B, A1 >: XMLEvent, B1 >: B](that: collection.Iterator[B], thisElem: A1, thatElem: B1): collection.Iterator[(A1, B1)]
    Definition Classes
    Iterator
  117. def zipWithIndex: collection.Iterator[(XMLEvent, Int)]
    Definition Classes
    Iterator
  118. object POISON extends XMLEvent with Product with Serializable
    Attributes
    protected

Inherited from AbstractIterator[XMLEvent]

Inherited from collection.Iterator[XMLEvent]

Inherited from GenTraversableOnce[XMLEvent]

Inherited from AnyRef

Inherited from Any

Ungrouped