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 transform
    Definition Classes
    xml
  • BasicTransformer
  • RewriteRule
  • RuleTransformer
c

scala.xml.transform

RuleTransformer

class RuleTransformer extends BasicTransformer

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. RuleTransformer
  2. BasicTransformer
  3. Function1
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new RuleTransformer(rules: RewriteRule*)

Value Members

  1. def andThen[A](g: (Node) ⇒ A): (Node) ⇒ A
    Definition Classes
    Function1
    Annotations
    @unspecialized()
  2. def apply(n: Node): Node
    Definition Classes
    BasicTransformer → Function1
  3. def compose[A](g: (A) ⇒ Node): (A) ⇒ Node
    Definition Classes
    Function1
    Annotations
    @unspecialized()
  4. def toString(): String
    Definition Classes
    Function1 → AnyRef → Any
  5. def transform(n: Node): collection.Seq[Node]
    Definition Classes
    RuleTransformerBasicTransformer
  6. def transform(ns: collection.Seq[Node]): collection.Seq[Node]

    Call transform(Node) to each node in ns, yield ns if nothing changes, otherwise a new sequence of concatenated results.

    Call transform(Node) to each node in ns, yield ns if nothing changes, otherwise a new sequence of concatenated results.

    Definition Classes
    BasicTransformer
  7. def transform(it: Iterator[Node], nb: NodeBuffer): collection.Seq[Node]

    Call transform(Node) for each node in ns, append results to NodeBuffer.

    Call transform(Node) for each node in ns, append results to NodeBuffer.

    Definition Classes
    BasicTransformer