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.

    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 factory
    Definition Classes
    xml
  • NodeFactory
  • XMLLoader
t

scala.xml.factory

XMLLoader

trait XMLLoader[T <: Node] extends AnyRef

Presents collection of XML loading methods which use the parser created by "def parser" or the reader created by "def reader".

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. XMLLoader
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. def adapter: FactoryAdapter
  2. def load(reader: Reader): T
  3. def load(inputStream: InputStream): T
  4. def load(sysId: String): T
  5. def load(url: URL): T
  6. def load(inputSource: InputSource): T
  7. def loadDocument(reader: Reader): Document
  8. def loadDocument(inputStream: InputStream): Document
  9. def loadDocument(sysId: String): Document
  10. def loadDocument(url: URL): Document
  11. def loadDocument(inputSource: InputSource): Document

    Loads XML Document.

  12. def loadFile(fileDescriptor: FileDescriptor): T
  13. def loadFile(file: File): T
  14. def loadFile(fileName: String): T
  15. def loadFileDocument(fileDescriptor: FileDescriptor): Document
  16. def loadFileDocument(file: File): Document
  17. def loadFileDocument(fileName: String): Document
  18. def loadFileNodes(fileDescriptor: FileDescriptor): Seq[Node]
  19. def loadFileNodes(file: File): Seq[Node]
  20. def loadFileNodes(fileName: String): Seq[Node]
  21. def loadNodes(reader: Reader): Seq[Node]
  22. def loadNodes(inputStream: InputStream): Seq[Node]
  23. def loadNodes(sysId: String): Seq[Node]
  24. def loadNodes(url: URL): Seq[Node]
  25. def loadNodes(inputSource: InputSource): Seq[Node]

    Load XML nodes, including comments and processing instructions that precede and follow the root element.

  26. def loadString(string: String): T
  27. def loadStringDocument(string: String): Document
  28. def loadStringNodes(string: String): Seq[Node]
  29. def loadXML(inputSource: InputSource, parser: SAXParser): T

    Loads XML from the given InputSource, using the supplied parser or reader.

    Loads XML from the given InputSource, using the supplied parser or reader. The methods available in scala.xml.XML use the XML parser in the JDK (unless another parser is present on the classpath).

  30. def loadXMLNodes(inputSource: InputSource, parser: SAXParser): Seq[Node]
  31. def parser: SAXParser
  32. def reader: org.xml.sax.XMLReader