• package root
    Definition Classes
  • package scala
    Definition Classes
  • 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">
        <mass unit="kg">5.9742e24</mass>
        <radius unit="m">6378.14e3</radius>
      <planet id="mars">
        <mass unit="kg">0.64191e24</mass>
        <radius unit="m">3397.0e3</radius>

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

    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.



package scala

Linear Supertypes
  1. Alphabetic
  2. By Inheritance
  1. scala
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
  1. Public
  2. All

Type Members

  1. type ::[A] = scala.collection.immutable.::[A]
  2. type AbstractMethodError = java.lang.AbstractMethodError
  3. type AnyRef = AnyRef
  4. type ArrayIndexOutOfBoundsException = java.lang.ArrayIndexOutOfBoundsException
  5. type BigDecimal = scala.math.BigDecimal
  6. type BigInt = scala.math.BigInt
  7. type ClassCastException = java.lang.ClassCastException
  8. type Either[+A, +B] = scala.util.Either[A, B]
  9. type Equiv[T] = scala.math.Equiv[T]
  10. type Error = java.lang.Error
  11. type Exception = java.lang.Exception
  12. type Fractional[T] = scala.math.Fractional[T]
  13. type IllegalArgumentException = java.lang.IllegalArgumentException
  14. type IndexOutOfBoundsException = java.lang.IndexOutOfBoundsException
  15. type IndexedSeq[+A] = scala.collection.immutable.IndexedSeq[A]

    (Changed in version 2.13.0) scala.IndexedSeq is now scala.collection.immutable.IndexedSeq instead of scala.collection.IndexedSeq

  16. type Integral[T] = scala.math.Integral[T]
  17. type InterruptedException = java.lang.InterruptedException
  18. type Iterable[+A] = scala.collection.Iterable[A]
  19. type IterableOnce[+A] = scala.collection.IterableOnce[A]
  20. type Iterator[+A] = scala.collection.Iterator[A]
  21. type LazyList[+A] = scala.collection.immutable.LazyList[A]
  22. type Left[+A, +B] = scala.util.Left[A, B]
  23. type List[+A] = scala.collection.immutable.List[A]
  24. type NoSuchElementException = java.util.NoSuchElementException
  25. type NullPointerException = java.lang.NullPointerException
  26. type NumberFormatException = java.lang.NumberFormatException
  27. type Numeric[T] = scala.math.Numeric[T]
  28. type Ordered[T] = scala.math.Ordered[T]
  29. type Ordering[T] = scala.math.Ordering[T]
  30. type PartialOrdering[T] = scala.math.PartialOrdering[T]
  31. type PartiallyOrdered[T] = scala.math.PartiallyOrdered[T]
  32. type Range = scala.collection.immutable.Range
  33. type Right[+A, +B] = scala.util.Right[A, B]
  34. type RuntimeException = java.lang.RuntimeException
  35. type Seq[+A] = scala.collection.immutable.Seq[A]

    (Changed in version 2.13.0) scala.Seq is now scala.collection.immutable.Seq instead of scala.collection.Seq

  36. type StringBuilder = scala.collection.mutable.StringBuilder
  37. type StringIndexOutOfBoundsException = java.lang.StringIndexOutOfBoundsException
  38. type Throwable = java.lang.Throwable
  39. type UnsupportedOperationException = java.lang.UnsupportedOperationException
  40. type Vector[+A] = scala.collection.immutable.Vector[A]
  41. type BufferedIterator[+A] = scala.collection.BufferedIterator[A]

    (Since version 2.13.0) Use scala.collection.BufferedIterator instead of scala.BufferedIterator

  42. type Stream[+A] = scala.collection.immutable.Stream[A]

    (Since version 2.13.0) Use LazyList instead of Stream

  43. type Traversable[+A] = scala.collection.Iterable[A]

    (Since version 2.13.0) Use Iterable instead of Traversable

  44. type TraversableOnce[+A] = scala.collection.IterableOnce[A]

    (Since version 2.13.0) Use IterableOnce instead of TraversableOnce

Value Members

  1. val +:: scala.collection.+:.type
  2. val :+: scala.collection.:+.type
  3. val ::: scala.collection.immutable.::.type
  4. val AnyRef: Specializable
  5. val BigDecimal: scala.math.BigDecimal.type
  6. val BigInt: scala.math.BigInt.type
  7. val Either: scala.util.Either.type
  8. val Equiv: scala.math.Equiv.type
  9. val Fractional: scala.math.Fractional.type
  10. val IndexedSeq: scala.collection.immutable.IndexedSeq.type
  11. val Integral: scala.math.Integral.type
  12. val Iterable: scala.collection.Iterable.type
  13. val Iterator: scala.collection.Iterator.type
  14. val LazyList: scala.collection.immutable.LazyList.type
  15. val Left: scala.util.Left.type
  16. val List: scala.collection.immutable.List.type
  17. val Nil: scala.collection.immutable.Nil.type
  18. val Numeric: scala.math.Numeric.type
  19. val Ordered: scala.math.Ordered.type
  20. val Ordering: scala.math.Ordering.type
  21. val Range: scala.collection.immutable.Range.type
  22. val Right: scala.util.Right.type
  23. val Seq: scala.collection.immutable.Seq.type
  24. val StringBuilder: scala.collection.mutable.StringBuilder.type
  25. val Vector: scala.collection.immutable.Vector.type

Deprecated Value Members

  1. val Stream: scala.collection.immutable.Stream.type

    (Since version 2.13.0) Use LazyList instead of Stream

  2. val Traversable: scala.collection.Iterable.type

    (Since version 2.13.0) Use Iterable instead of Traversable

Inherited from AnyRef

Inherited from Any