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.

Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. XMLEventReader
  2. ProducerConsumerIterator
  3. AbstractIterator
  4. Iterator
  5. IterableOnceOps
  6. IterableOnce
  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.immutable.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. final def ++[B >: XMLEvent](xs: ⇒ collection.IterableOnce[B]): collection.Iterator[B]
    Definition Classes
    Iterator
    Annotations
    @inline()
  4. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  5. val EndOfStream: POISON
  6. val MaxQueueSize: Int
  7. def addString(b: collection.mutable.StringBuilder): collection.mutable.StringBuilder
    Definition Classes
    IterableOnceOps
  8. def addString(b: collection.mutable.StringBuilder, sep: String): collection.mutable.StringBuilder
    Definition Classes
    IterableOnceOps
  9. def addString(b: collection.mutable.StringBuilder, start: String, sep: String, end: String): b.type
    Definition Classes
    IterableOnceOps
  10. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  11. def available(): Boolean
    Definition Classes
    ProducerConsumerIterator
  12. def buffered: collection.BufferedIterator[XMLEvent]
    Definition Classes
    Iterator
  13. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @throws(classOf[java.lang.CloneNotSupportedException])
  14. def collect[B](pf: PartialFunction[XMLEvent, B]): collection.Iterator[B]
    Definition Classes
    Iterator → IterableOnceOps
  15. def collectFirst[B](pf: PartialFunction[XMLEvent, B]): Option[B]
    Definition Classes
    IterableOnceOps
  16. def concat[B >: XMLEvent](xs: ⇒ collection.IterableOnce[B]): collection.Iterator[B]
    Definition Classes
    Iterator
  17. def contains(elem: Any): Boolean
    Definition Classes
    Iterator
  18. def copyToArray[B >: XMLEvent](xs: Array[B], start: Int, len: Int): xs.type
    Definition Classes
    IterableOnceOps
  19. def copyToArray[B >: XMLEvent](xs: Array[B], start: Int): xs.type
    Definition Classes
    IterableOnceOps
  20. def count(p: (XMLEvent) ⇒ Boolean): Int
    Definition Classes
    IterableOnceOps
  21. def distinct: collection.Iterator[XMLEvent]
    Definition Classes
    Iterator
  22. def distinctBy[B](f: (XMLEvent) ⇒ B): collection.Iterator[XMLEvent]
    Definition Classes
    Iterator
  23. def drop(n: Int): collection.Iterator[XMLEvent]
    Definition Classes
    Iterator → IterableOnceOps
  24. def dropWhile(p: (XMLEvent) ⇒ Boolean): collection.Iterator[XMLEvent]
    Definition Classes
    Iterator → IterableOnceOps
  25. def duplicate: (collection.Iterator[XMLEvent], collection.Iterator[XMLEvent])
    Definition Classes
    Iterator
  26. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  27. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  28. def exists(p: (XMLEvent) ⇒ Boolean): Boolean
    Definition Classes
    IterableOnceOps
  29. def filter(p: (XMLEvent) ⇒ Boolean): collection.Iterator[XMLEvent]
    Definition Classes
    Iterator → IterableOnceOps
  30. def filterNot(p: (XMLEvent) ⇒ Boolean): collection.Iterator[XMLEvent]
    Definition Classes
    Iterator → IterableOnceOps
  31. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  32. def find(p: (XMLEvent) ⇒ Boolean): Option[XMLEvent]
    Definition Classes
    IterableOnceOps
  33. def flatMap[B](f: (XMLEvent) ⇒ collection.IterableOnce[B]): collection.Iterator[B]
    Definition Classes
    Iterator → IterableOnceOps
  34. def flatten[B](implicit ev: (XMLEvent) ⇒ collection.IterableOnce[B]): collection.Iterator[B]
    Definition Classes
    Iterator → IterableOnceOps
  35. def fold[A1 >: XMLEvent](z: A1)(op: (A1, A1) ⇒ A1): A1
    Definition Classes
    IterableOnceOps
  36. def foldLeft[B](z: B)(op: (B, XMLEvent) ⇒ B): B
    Definition Classes
    IterableOnceOps
  37. def foldRight[B](z: B)(op: (XMLEvent, B) ⇒ B): B
    Definition Classes
    IterableOnceOps
  38. def forall(p: (XMLEvent) ⇒ Boolean): Boolean
    Definition Classes
    IterableOnceOps
  39. def foreach[U](f: (XMLEvent) ⇒ U): Unit
    Definition Classes
    IterableOnceOps
  40. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  41. def grouped[B >: XMLEvent](size: Int): GroupedIterator[B]
    Definition Classes
    Iterator
  42. def hasNext: Boolean
    Definition Classes
    ProducerConsumerIterator → Iterator
  43. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  44. def indexOf[B >: XMLEvent](elem: B, from: Int): Int
    Definition Classes
    Iterator
  45. def indexOf[B >: XMLEvent](elem: B): Int
    Definition Classes
    Iterator
  46. def indexWhere(p: (XMLEvent) ⇒ Boolean, from: Int): Int
    Definition Classes
    Iterator
  47. def interruptibly[A](body: ⇒ A): Option[A]
    Definition Classes
    ProducerConsumerIterator
  48. def isEmpty: Boolean
    Definition Classes
    IterableOnceOps
  49. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  50. def iterator: collection.Iterator[XMLEvent]
    Definition Classes
    Iterator → IterableOnce
  51. def knownSize: Int
    Definition Classes
    IterableOnceOps
  52. final def length: Int
    Definition Classes
    Iterator
  53. def map[B](f: (XMLEvent) ⇒ B): collection.Iterator[B]
    Definition Classes
    Iterator → IterableOnceOps
  54. def max[B >: XMLEvent](implicit ord: math.Ordering[B]): XMLEvent
    Definition Classes
    IterableOnceOps
  55. def maxBy[B](f: (XMLEvent) ⇒ B)(implicit cmp: math.Ordering[B]): XMLEvent
    Definition Classes
    IterableOnceOps
  56. def maxByOption[B](f: (XMLEvent) ⇒ B)(implicit cmp: math.Ordering[B]): Option[XMLEvent]
    Definition Classes
    IterableOnceOps
  57. def maxOption[B >: XMLEvent](implicit ord: math.Ordering[B]): Option[XMLEvent]
    Definition Classes
    IterableOnceOps
  58. def min[B >: XMLEvent](implicit ord: math.Ordering[B]): XMLEvent
    Definition Classes
    IterableOnceOps
  59. def minBy[B](f: (XMLEvent) ⇒ B)(implicit cmp: math.Ordering[B]): XMLEvent
    Definition Classes
    IterableOnceOps
  60. def minByOption[B](f: (XMLEvent) ⇒ B)(implicit cmp: math.Ordering[B]): Option[XMLEvent]
    Definition Classes
    IterableOnceOps
  61. def minOption[B >: XMLEvent](implicit ord: math.Ordering[B]): Option[XMLEvent]
    Definition Classes
    IterableOnceOps
  62. def mkString: String
    Definition Classes
    IterableOnceOps
  63. def mkString(sep: String): String
    Definition Classes
    IterableOnceOps
  64. def mkString(start: String, sep: String, end: String): String
    Definition Classes
    IterableOnceOps
  65. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  66. def next(): XMLEvent
    Definition Classes
    ProducerConsumerIterator → Iterator
  67. def nextOption(): Option[XMLEvent]
    Definition Classes
    Iterator
  68. def nonEmpty: Boolean
    Definition Classes
    IterableOnceOps
    Annotations
    @deprecatedOverriding("nonEmpty is defined as !isEmpty; override isEmpty instead", "2.13.0")
  69. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  70. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  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: math.Numeric[B]): B
    Definition Classes
    IterableOnceOps
  75. def reduce[B >: XMLEvent](op: (B, B) ⇒ B): B
    Definition Classes
    IterableOnceOps
  76. def reduceLeft[B >: XMLEvent](op: (B, XMLEvent) ⇒ B): B
    Definition Classes
    IterableOnceOps
  77. def reduceLeftOption[B >: XMLEvent](op: (B, XMLEvent) ⇒ B): Option[B]
    Definition Classes
    IterableOnceOps
  78. def reduceOption[B >: XMLEvent](op: (B, B) ⇒ B): Option[B]
    Definition Classes
    IterableOnceOps
  79. def reduceRight[B >: XMLEvent](op: (XMLEvent, B) ⇒ B): B
    Definition Classes
    IterableOnceOps
  80. def reduceRightOption[B >: XMLEvent](op: (XMLEvent, B) ⇒ B): Option[B]
    Definition Classes
    IterableOnceOps
  81. def reversed: collection.Iterable[XMLEvent]
    Attributes
    protected
    Definition Classes
    IterableOnceOps
  82. def sameElements[B >: XMLEvent](that: collection.IterableOnce[B]): Boolean
    Definition Classes
    Iterator
  83. def scanLeft[B](z: B)(op: (B, XMLEvent) ⇒ B): collection.Iterator[B]
    Definition Classes
    Iterator → IterableOnceOps
  84. def size: Int
    Definition Classes
    IterableOnceOps
  85. def slice(from: Int, until: Int): collection.Iterator[XMLEvent]
    Definition Classes
    Iterator → IterableOnceOps
  86. def sliceIterator(from: Int, until: Int): collection.Iterator[XMLEvent]
    Attributes
    protected
    Definition Classes
    Iterator
  87. def sliding[B >: XMLEvent](size: Int, step: Int): GroupedIterator[B]
    Definition Classes
    Iterator
  88. def span(p: (XMLEvent) ⇒ Boolean): (collection.Iterator[XMLEvent], collection.Iterator[XMLEvent])
    Definition Classes
    Iterator → IterableOnceOps
  89. def stop(): Unit
  90. def sum[B >: XMLEvent](implicit num: math.Numeric[B]): B
    Definition Classes
    IterableOnceOps
  91. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  92. def take(n: Int): collection.Iterator[XMLEvent]
    Definition Classes
    Iterator → IterableOnceOps
  93. def takeWhile(p: (XMLEvent) ⇒ Boolean): collection.Iterator[XMLEvent]
    Definition Classes
    Iterator → IterableOnceOps
  94. def to[C1](factory: Factory[XMLEvent, C1]): C1
    Definition Classes
    IterableOnceOps
  95. def toArray[B >: XMLEvent](implicit arg0: ClassTag[B]): Array[B]
    Definition Classes
    IterableOnceOps
  96. def toIndexedSeq: collection.immutable.IndexedSeq[XMLEvent]
    Definition Classes
    IterableOnceOps
  97. def toList: collection.immutable.List[XMLEvent]
    Definition Classes
    IterableOnceOps
  98. def toMap[K, V](implicit ev: <:<[XMLEvent, (K, V)]): Map[K, V]
    Definition Classes
    IterableOnceOps
  99. def toSeq: collection.immutable.Seq[XMLEvent]
    Definition Classes
    IterableOnceOps
  100. def toSet[B >: XMLEvent]: Set[B]
    Definition Classes
    IterableOnceOps
  101. def toString(): String
    Definition Classes
    Iterator → AnyRef → Any
  102. def toVector: collection.immutable.Vector[XMLEvent]
    Definition Classes
    IterableOnceOps
  103. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  104. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  105. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws(classOf[java.lang.InterruptedException])
  106. def withFilter(p: (XMLEvent) ⇒ Boolean): collection.Iterator[XMLEvent]
    Definition Classes
    Iterator
  107. def zip[B](that: collection.IterableOnce[B]): collection.Iterator[(XMLEvent, B)]
    Definition Classes
    Iterator
  108. def zipAll[A1 >: XMLEvent, B](that: collection.IterableOnce[B], thisElem: A1, thatElem: B): collection.Iterator[(A1, B)]
    Definition Classes
    Iterator
  109. def zipWithIndex: collection.Iterator[(XMLEvent, Int)]
    Definition Classes
    Iterator → IterableOnceOps
  110. object POISON extends XMLEvent with Product with Serializable
    Attributes
    protected

Deprecated Value Members

  1. final def /:[B](z: B)(op: (B, XMLEvent) ⇒ B): B
    Definition Classes
    IterableOnceOps
    Annotations
    @deprecated @inline()
    Deprecated

    (Since version 2.13.0) Use foldLeft instead of /:

  2. final def :\[B](z: B)(op: (XMLEvent, B) ⇒ B): B
    Definition Classes
    IterableOnceOps
    Annotations
    @deprecated @inline()
    Deprecated

    (Since version 2.13.0) Use foldRight instead of :\

  3. final def copyToBuffer[B >: XMLEvent](dest: Buffer[B]): Unit
    Definition Classes
    IterableOnceOps
    Annotations
    @deprecated @inline()
    Deprecated

    (Since version 2.13.0) Use dest ++= coll instead

  4. def seq: XMLEventReader.this.type
    Definition Classes
    Iterator
    Annotations
    @deprecated
    Deprecated

    (Since version 2.13.0) Iterator.seq always returns the iterator itself

  5. final def toBuffer[B >: XMLEvent]: Buffer[B]
    Definition Classes
    IterableOnceOps
    Annotations
    @deprecated @inline()
    Deprecated

    (Since version 2.13.0) Use ArrayBuffer.from(it) instead of it.toBuffer

  6. final def toIterator: collection.Iterator[XMLEvent]
    Definition Classes
    IterableOnceOps
    Annotations
    @deprecated @inline()
    Deprecated

    (Since version 2.13.0) Use .iterator instead of .toIterator

  7. final def toStream: collection.immutable.Stream[XMLEvent]
    Definition Classes
    IterableOnceOps
    Annotations
    @deprecated @inline()
    Deprecated

    (Since version 2.13.0) Use Stream.from(it) instead of it.toStream

Ungrouped