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("""<?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(
    
    )
    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. IterableOnceOps
  6. IterableOnce
  7. AnyRef
  8. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

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. final def addString(b: collection.mutable.StringBuilder): collection.mutable.StringBuilder
    Definition Classes
    IterableOnceOps
    Annotations
    @inline()
  8. final def addString(b: collection.mutable.StringBuilder, sep: String): collection.mutable.StringBuilder
    Definition Classes
    IterableOnceOps
    Annotations
    @inline()
  9. def addString(b: collection.mutable.StringBuilder, start: String, sep: String, end: String): collection.mutable.StringBuilder
    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[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  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): Int
    Definition Classes
    IterableOnceOps
  19. def copyToArray[B >: XMLEvent](xs: Array[B], start: Int): Int
    Definition Classes
    IterableOnceOps
  20. def copyToArray[B >: XMLEvent](xs: Array[B]): Int
    Definition Classes
    IterableOnceOps
  21. def corresponds[B](that: collection.IterableOnce[B])(p: (XMLEvent, B) => Boolean): Boolean
    Definition Classes
    IterableOnceOps
  22. def count(p: (XMLEvent) => Boolean): Int
    Definition Classes
    IterableOnceOps
  23. def distinct: collection.Iterator[XMLEvent]
    Definition Classes
    Iterator
  24. def distinctBy[B](f: (XMLEvent) => B): collection.Iterator[XMLEvent]
    Definition Classes
    Iterator
  25. def drop(n: Int): collection.Iterator[XMLEvent]
    Definition Classes
    Iterator → IterableOnceOps
  26. def dropWhile(p: (XMLEvent) => Boolean): collection.Iterator[XMLEvent]
    Definition Classes
    Iterator → IterableOnceOps
  27. def duplicate: (collection.Iterator[XMLEvent], collection.Iterator[XMLEvent])
    Definition Classes
    Iterator
  28. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  29. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  30. def exists(p: (XMLEvent) => Boolean): Boolean
    Definition Classes
    IterableOnceOps
  31. def filter(p: (XMLEvent) => Boolean): collection.Iterator[XMLEvent]
    Definition Classes
    Iterator → IterableOnceOps
  32. def filterNot(p: (XMLEvent) => Boolean): collection.Iterator[XMLEvent]
    Definition Classes
    Iterator → IterableOnceOps
  33. def find(p: (XMLEvent) => Boolean): Option[XMLEvent]
    Definition Classes
    IterableOnceOps
  34. def flatMap[B](f: (XMLEvent) => collection.IterableOnce[B]): collection.Iterator[B]
    Definition Classes
    Iterator → IterableOnceOps
  35. def flatten[B](implicit ev: (XMLEvent) => collection.IterableOnce[B]): collection.Iterator[B]
    Definition Classes
    Iterator → IterableOnceOps
  36. def fold[A1 >: XMLEvent](z: A1)(op: (A1, A1) => A1): A1
    Definition Classes
    IterableOnceOps
  37. def foldLeft[B](z: B)(op: (B, XMLEvent) => B): B
    Definition Classes
    IterableOnceOps
  38. def foldRight[B](z: B)(op: (XMLEvent, B) => B): B
    Definition Classes
    IterableOnceOps
  39. def forall(p: (XMLEvent) => Boolean): Boolean
    Definition Classes
    IterableOnceOps
  40. def foreach[U](f: (XMLEvent) => U): Unit
    Definition Classes
    IterableOnceOps
  41. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  42. def grouped[B >: XMLEvent](size: Int): GroupedIterator[B]
    Definition Classes
    Iterator
  43. def hasNext: Boolean
    Definition Classes
    ProducerConsumerIterator → Iterator
  44. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  45. def indexOf[B >: XMLEvent](elem: B, from: Int): Int
    Definition Classes
    Iterator
  46. def indexOf[B >: XMLEvent](elem: B): Int
    Definition Classes
    Iterator
  47. def indexWhere(p: (XMLEvent) => Boolean, from: Int): Int
    Definition Classes
    Iterator
  48. def interruptibly[A](body: => A): Option[A]
    Definition Classes
    ProducerConsumerIterator
  49. def isEmpty: Boolean
    Definition Classes
    Iterator → IterableOnceOps
    Annotations
    @deprecatedOverriding("isEmpty is defined as !hasNext; override hasNext instead", "2.13.0")
  50. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  51. def isTraversableAgain: Boolean
    Definition Classes
    IterableOnceOps
  52. final def iterator: collection.Iterator[XMLEvent]
    Definition Classes
    Iterator → IterableOnce
    Annotations
    @inline()
  53. def knownSize: Int
    Definition Classes
    IterableOnce
  54. final def length: Int
    Definition Classes
    Iterator
    Annotations
    @inline()
  55. def map[B](f: (XMLEvent) => B): collection.Iterator[B]
    Definition Classes
    Iterator → IterableOnceOps
  56. def max[B >: XMLEvent](implicit ord: math.Ordering[B]): XMLEvent
    Definition Classes
    IterableOnceOps
  57. def maxBy[B](f: (XMLEvent) => B)(implicit cmp: math.Ordering[B]): XMLEvent
    Definition Classes
    IterableOnceOps
  58. def maxByOption[B](f: (XMLEvent) => B)(implicit cmp: math.Ordering[B]): Option[XMLEvent]
    Definition Classes
    IterableOnceOps
  59. def maxOption[B >: XMLEvent](implicit ord: math.Ordering[B]): Option[XMLEvent]
    Definition Classes
    IterableOnceOps
  60. def min[B >: XMLEvent](implicit ord: math.Ordering[B]): XMLEvent
    Definition Classes
    IterableOnceOps
  61. def minBy[B](f: (XMLEvent) => B)(implicit cmp: math.Ordering[B]): XMLEvent
    Definition Classes
    IterableOnceOps
  62. def minByOption[B](f: (XMLEvent) => B)(implicit cmp: math.Ordering[B]): Option[XMLEvent]
    Definition Classes
    IterableOnceOps
  63. def minOption[B >: XMLEvent](implicit ord: math.Ordering[B]): Option[XMLEvent]
    Definition Classes
    IterableOnceOps
  64. final def mkString: String
    Definition Classes
    IterableOnceOps
    Annotations
    @inline()
  65. final def mkString(sep: String): String
    Definition Classes
    IterableOnceOps
    Annotations
    @inline()
  66. final def mkString(start: String, sep: String, end: String): String
    Definition Classes
    IterableOnceOps
  67. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  68. def next(): XMLEvent
    Definition Classes
    ProducerConsumerIterator → Iterator
  69. def nextOption(): Option[XMLEvent]
    Definition Classes
    Iterator
  70. def nonEmpty: Boolean
    Definition Classes
    IterableOnceOps
    Annotations
    @deprecatedOverriding("nonEmpty is defined as !isEmpty; override isEmpty instead", "2.13.0")
  71. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  72. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  73. def padTo[B >: XMLEvent](len: Int, elem: B): collection.Iterator[B]
    Definition Classes
    Iterator
  74. def partition(p: (XMLEvent) => Boolean): (collection.Iterator[XMLEvent], collection.Iterator[XMLEvent])
    Definition Classes
    Iterator
  75. def patch[B >: XMLEvent](from: Int, patchElems: collection.Iterator[B], replaced: Int): collection.Iterator[B]
    Definition Classes
    Iterator
  76. val preserveWS: Boolean
  77. def produce(x: XMLEvent): Unit
    Definition Classes
    ProducerConsumerIterator
  78. def product[B >: XMLEvent](implicit num: math.Numeric[B]): B
    Definition Classes
    IterableOnceOps
  79. def reduce[B >: XMLEvent](op: (B, B) => B): B
    Definition Classes
    IterableOnceOps
  80. def reduceLeft[B >: XMLEvent](op: (B, XMLEvent) => B): B
    Definition Classes
    IterableOnceOps
  81. def reduceLeftOption[B >: XMLEvent](op: (B, XMLEvent) => B): Option[B]
    Definition Classes
    IterableOnceOps
  82. def reduceOption[B >: XMLEvent](op: (B, B) => B): Option[B]
    Definition Classes
    IterableOnceOps
  83. def reduceRight[B >: XMLEvent](op: (XMLEvent, B) => B): B
    Definition Classes
    IterableOnceOps
  84. def reduceRightOption[B >: XMLEvent](op: (XMLEvent, B) => B): Option[B]
    Definition Classes
    IterableOnceOps
  85. def reversed: collection.Iterable[XMLEvent]
    Attributes
    protected
    Definition Classes
    IterableOnceOps
  86. def sameElements[B >: XMLEvent](that: collection.IterableOnce[B]): Boolean
    Definition Classes
    Iterator
  87. def scanLeft[B](z: B)(op: (B, XMLEvent) => B): collection.Iterator[B]
    Definition Classes
    Iterator → IterableOnceOps
  88. def size: Int
    Definition Classes
    IterableOnceOps
  89. def slice(from: Int, until: Int): collection.Iterator[XMLEvent]
    Definition Classes
    Iterator → IterableOnceOps
  90. def sliceIterator(from: Int, until: Int): collection.Iterator[XMLEvent]
    Attributes
    protected
    Definition Classes
    Iterator
  91. def sliding[B >: XMLEvent](size: Int, step: Int): GroupedIterator[B]
    Definition Classes
    Iterator
  92. def span(p: (XMLEvent) => Boolean): (collection.Iterator[XMLEvent], collection.Iterator[XMLEvent])
    Definition Classes
    Iterator → IterableOnceOps
  93. def splitAt(n: Int): (collection.Iterator[XMLEvent], collection.Iterator[XMLEvent])
    Definition Classes
    IterableOnceOps
  94. def stepper[S <: Stepper[_]](implicit shape: StepperShape[XMLEvent, S]): S
    Definition Classes
    IterableOnce
  95. def stop(): Unit
  96. def sum[B >: XMLEvent](implicit num: math.Numeric[B]): B
    Definition Classes
    IterableOnceOps
  97. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  98. def take(n: Int): collection.Iterator[XMLEvent]
    Definition Classes
    Iterator → IterableOnceOps
  99. def takeWhile(p: (XMLEvent) => Boolean): collection.Iterator[XMLEvent]
    Definition Classes
    Iterator → IterableOnceOps
  100. def tapEach[U](f: (XMLEvent) => U): collection.Iterator[XMLEvent]
    Definition Classes
    Iterator → IterableOnceOps
  101. def to[C1](factory: Factory[XMLEvent, C1]): C1
    Definition Classes
    IterableOnceOps
  102. def toArray[B >: XMLEvent](implicit arg0: ClassTag[B]): Array[B]
    Definition Classes
    IterableOnceOps
  103. final def toBuffer[B >: XMLEvent]: Buffer[B]
    Definition Classes
    IterableOnceOps
    Annotations
    @inline()
  104. def toIndexedSeq: collection.immutable.IndexedSeq[XMLEvent]
    Definition Classes
    IterableOnceOps
  105. def toList: collection.immutable.List[XMLEvent]
    Definition Classes
    IterableOnceOps
  106. def toMap[K, V](implicit ev: <:<[XMLEvent, (K, V)]): Map[K, V]
    Definition Classes
    IterableOnceOps
  107. def toSeq: collection.immutable.Seq[XMLEvent]
    Definition Classes
    IterableOnceOps
  108. def toSet[B >: XMLEvent]: Set[B]
    Definition Classes
    IterableOnceOps
  109. def toString(): String
    Definition Classes
    Iterator → AnyRef → Any
  110. def toVector: collection.immutable.Vector[XMLEvent]
    Definition Classes
    IterableOnceOps
  111. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  112. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  113. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  114. def withFilter(p: (XMLEvent) => Boolean): collection.Iterator[XMLEvent]
    Definition Classes
    Iterator
  115. def zip[B](that: collection.IterableOnce[B]): collection.Iterator[(XMLEvent, B)]
    Definition Classes
    Iterator
  116. def zipAll[A1 >: XMLEvent, B](that: collection.IterableOnce[B], thisElem: A1, thatElem: B): collection.Iterator[(A1, B)]
    Definition Classes
    Iterator
  117. def zipWithIndex: collection.Iterator[(XMLEvent, Int)]
    Definition Classes
    Iterator → IterableOnceOps
  118. 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. def aggregate[B](z: => B)(seqop: (B, XMLEvent) => B, combop: (B, B) => B): B
    Definition Classes
    IterableOnceOps
    Annotations
    @deprecated
    Deprecated

    (Since version 2.13.0) aggregate is not relevant for sequential collections. Use foldLeft(z)(seqop) instead.

  4. 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

  5. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated @deprecated
    Deprecated

    (Since version ) see corresponding Javadoc for more information.

  6. final def hasDefiniteSize: Boolean
    Definition Classes
    Iterator → IterableOnceOps
    Annotations
    @deprecated @inline()
    Deprecated

    (Since version 2.13.0) hasDefiniteSize on Iterator is the same as isEmpty

  7. def scanRight[B](z: B)(op: (XMLEvent, B) => B): collection.Iterator[B]
    Definition Classes
    Iterator
    Annotations
    @deprecated
    Deprecated

    (Since version 2.13.0) Call scanRight on an Iterable instead.

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

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

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

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

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

    (Since version 2.13.0) Use .to(LazyList) instead of .toStream

Ungrouped