scala
package scala
- Alphabetic
- By Inheritance
- scala
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Package Members
- 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.
Type Members
- type ::[A] = scala.collection.immutable.::[A]
- type AbstractMethodError = java.lang.AbstractMethodError
- type AnyRef = AnyRef
- type ArrayIndexOutOfBoundsException = java.lang.ArrayIndexOutOfBoundsException
- type BigDecimal = scala.math.BigDecimal
- type BigInt = scala.math.BigInt
- type ClassCastException = java.lang.ClassCastException
- type Cloneable = java.lang.Cloneable
- type Either[+A, +B] = scala.util.Either[A, B]
- type Equiv[T] = scala.math.Equiv[T]
- type Error = java.lang.Error
- type Exception = java.lang.Exception
- type Fractional[T] = scala.math.Fractional[T]
- type IllegalArgumentException = java.lang.IllegalArgumentException
- type IndexOutOfBoundsException = java.lang.IndexOutOfBoundsException
- type IndexedSeq[+A] = scala.collection.immutable.IndexedSeq[A]
- Annotations
- @migration
- Migration
(Changed in version 2.13.0) scala.IndexedSeq is now scala.collection.immutable.IndexedSeq instead of scala.collection.IndexedSeq
- type Integral[T] = scala.math.Integral[T]
- type InterruptedException = java.lang.InterruptedException
- type Iterable[+A] = scala.collection.Iterable[A]
- type IterableOnce[+A] = scala.collection.IterableOnce[A]
- type Iterator[+A] = scala.collection.Iterator[A]
- type LazyList[+A] = scala.collection.immutable.LazyList[A]
- type Left[+A, +B] = scala.util.Left[A, B]
- type List[+A] = scala.collection.immutable.List[A]
- type NoSuchElementException = java.util.NoSuchElementException
- type NullPointerException = java.lang.NullPointerException
- type NumberFormatException = java.lang.NumberFormatException
- type Numeric[T] = scala.math.Numeric[T]
- type Ordered[T] = scala.math.Ordered[T]
- type Ordering[T] = scala.math.Ordering[T]
- type PartialOrdering[T] = scala.math.PartialOrdering[T]
- type PartiallyOrdered[T] = scala.math.PartiallyOrdered[T]
- type Range = scala.collection.immutable.Range
- type Right[+A, +B] = scala.util.Right[A, B]
- type RuntimeException = java.lang.RuntimeException
- type Seq[+A] = scala.collection.immutable.Seq[A]
- Annotations
- @migration
- Migration
(Changed in version 2.13.0) scala.Seq is now scala.collection.immutable.Seq instead of scala.collection.Seq
- type Serializable = java.io.Serializable
- type StringBuilder = scala.collection.mutable.StringBuilder
- type StringIndexOutOfBoundsException = java.lang.StringIndexOutOfBoundsException
- type Throwable = java.lang.Throwable
- type UnsupportedOperationException = java.lang.UnsupportedOperationException
- type Vector[+A] = scala.collection.immutable.Vector[A]
Deprecated Type Members
- type BufferedIterator[+A] = scala.collection.BufferedIterator[A]
- Annotations
- @deprecated
- Deprecated
(Since version 2.13.0) Use scala.collection.BufferedIterator instead of scala.BufferedIterator
- type Stream[+A] = scala.collection.immutable.Stream[A]
- Annotations
- @deprecated
- Deprecated
(Since version 2.13.0) Use LazyList instead of Stream
- type Traversable[+A] = scala.collection.Iterable[A]
- Annotations
- @deprecated
- Deprecated
(Since version 2.13.0) Use Iterable instead of Traversable
- type TraversableOnce[+A] = scala.collection.IterableOnce[A]
- Annotations
- @deprecated
- Deprecated
(Since version 2.13.0) Use IterableOnce instead of TraversableOnce
Value Members
- val +:: scala.collection.+:.type
- val :+: scala.collection.:+.type
- val ::: scala.collection.immutable.::.type
- val AnyRef: Specializable
- val BigDecimal: scala.math.BigDecimal.type
- val BigInt: scala.math.BigInt.type
- val Either: scala.util.Either.type
- val Equiv: scala.math.Equiv.type
- val Fractional: scala.math.Fractional.type
- val IndexedSeq: scala.collection.immutable.IndexedSeq.type
- val Integral: scala.math.Integral.type
- val Iterable: scala.collection.Iterable.type
- val Iterator: scala.collection.Iterator.type
- val LazyList: scala.collection.immutable.LazyList.type
- val Left: scala.util.Left.type
- val List: scala.collection.immutable.List.type
- val Nil: scala.collection.immutable.Nil.type
- val Numeric: scala.math.Numeric.type
- val Ordered: scala.math.Ordered.type
- val Ordering: scala.math.Ordering.type
- val Range: scala.collection.immutable.Range.type
- val Right: scala.util.Right.type
- val Seq: scala.collection.immutable.Seq.type
- val StringBuilder: scala.collection.mutable.StringBuilder.type
- val Vector: scala.collection.immutable.Vector.type
Deprecated Value Members
- val Stream: scala.collection.immutable.Stream.type
- Annotations
- @deprecated
- Deprecated
(Since version 2.13.0) Use LazyList instead of Stream
- val Traversable: scala.collection.Iterable.type
- Annotations
- @deprecated
- Deprecated
(Since version 2.13.0) Use Iterable instead of Traversable