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 include
    Definition Classes
    xml
  • package sax
    Definition Classes
    include
  • EncodingHeuristics
  • XIncludeFilter
  • XIncluder
c

scala.xml.include.sax

XIncludeFilter

class XIncludeFilter extends XMLFilterImpl

This is a SAX filter which resolves all XInclude include elements before passing them on to the client application. Currently this class has the following known deviation from the XInclude specification:

  1. XPointer is not supported.

Furthermore, I would definitely use a new instance of this class for each document you want to process. I doubt it can be used successfully on multiple documents. Furthermore, I can virtually guarantee that this class is not thread safe. You have been warned.

Since this class is not designed to be subclassed, and since I have not yet considered how that might affect the methods herein or what other protected methods might be needed to support subclasses, I have declared this class final. I may remove this restriction later, though the use-case for subclassing is weak. This class is designed to have its functionality extended via a horizontal chain of filters, not a vertical hierarchy of sub and superclasses.

To use this class:

  • Construct an XIncludeFilter object with a known base URL
  • Pass the XMLReader object from which the raw document will be read to the setParent() method of this object.
  • Pass your own ContentHandler object to the setContentHandler() method of this object. This is the object which will receive events from the parsed and included document.
  • Optional: if you wish to receive comments, set your own LexicalHandler object as the value of this object's http://xml.org/sax/properties/lexical-handler property. Also make sure your LexicalHandler asks this object for the status of each comment using insideIncludeElement before doing anything with the comment.
  • Pass the URL of the document to read to this object's parse() method

e.g.

val includer = new XIncludeFilter(base)
includer setParent parser
includer setContentHandler new SAXXIncluder(System.out)
includer parse args(i)

translated from Elliotte Rusty Harold's Java source.

Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. XIncludeFilter
  2. XMLFilterImpl
  3. ErrorHandler
  4. ContentHandler
  5. DTDHandler
  6. EntityResolver
  7. XMLFilter
  8. XMLReader
  9. AnyRef
  10. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new XIncludeFilter()

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final val XINCLUDE_NAMESPACE: String("http://www.w3.org/2001/XInclude")
  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. def characters(ch: Array[Char], start: Int, length: Int): Unit
    Definition Classes
    XIncludeFilter → XMLFilterImpl → ContentHandler
  7. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  8. def endDocument(): Unit
    Definition Classes
    XIncludeFilter → XMLFilterImpl → ContentHandler
  9. def endElement(uri: String, localName: String, qName: String): Unit
    Definition Classes
    XIncludeFilter → XMLFilterImpl → ContentHandler
  10. def endPrefixMapping(prefix: String): Unit
    Definition Classes
    XIncludeFilter → XMLFilterImpl → ContentHandler
  11. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  12. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  13. def error(arg0: org.xml.sax.SAXParseException): Unit
    Definition Classes
    XMLFilterImpl → ErrorHandler
    Annotations
    @throws( classOf[org.xml.sax.SAXException] )
  14. def fatalError(arg0: org.xml.sax.SAXParseException): Unit
    Definition Classes
    XMLFilterImpl → ErrorHandler
    Annotations
    @throws( classOf[org.xml.sax.SAXException] )
  15. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  16. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  17. def getContentHandler(): ContentHandler
    Definition Classes
    XMLFilterImpl → XMLReader
  18. def getDTDHandler(): DTDHandler
    Definition Classes
    XMLFilterImpl → XMLReader
  19. def getEntityResolver(): org.xml.sax.EntityResolver
    Definition Classes
    XMLFilterImpl → XMLReader
  20. def getErrorHandler(): ErrorHandler
    Definition Classes
    XMLFilterImpl → XMLReader
  21. def getFeature(arg0: String): Boolean
    Definition Classes
    XMLFilterImpl → XMLReader
    Annotations
    @throws( ... ) @throws( ... )
  22. def getParent(): XMLReader
    Definition Classes
    XMLFilterImpl → XMLFilter
  23. def getProperty(arg0: String): AnyRef
    Definition Classes
    XMLFilterImpl → XMLReader
    Annotations
    @throws( ... ) @throws( ... )
  24. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  25. def ignorableWhitespace(ch: Array[Char], start: Int, length: Int): Unit
    Definition Classes
    XIncludeFilter → XMLFilterImpl → ContentHandler
  26. def insideIncludeElement(): Boolean

    This utility method returns true if and only if this reader is currently inside a non-empty include element.

    This utility method returns true if and only if this reader is currently inside a non-empty include element. (This is not the same as being inside the node set which replaces the include element.) This is primarily needed for comments inside include elements. It must be checked by the actual LexicalHandler to see whether a comment is passed or not.

    returns

    boolean

  27. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  28. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  29. def notationDecl(arg0: String, arg1: String, arg2: String): Unit
    Definition Classes
    XMLFilterImpl → DTDHandler
    Annotations
    @throws( classOf[org.xml.sax.SAXException] )
  30. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  31. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  32. def parse(arg0: String): Unit
    Definition Classes
    XMLFilterImpl → XMLReader
    Annotations
    @throws( classOf[java.io.IOException] ) @throws( classOf[org.xml.sax.SAXException] )
  33. def parse(arg0: org.xml.sax.InputSource): Unit
    Definition Classes
    XMLFilterImpl → XMLReader
    Annotations
    @throws( classOf[java.io.IOException] ) @throws( classOf[org.xml.sax.SAXException] )
  34. def processingInstruction(target: String, data: String): Unit
    Definition Classes
    XIncludeFilter → XMLFilterImpl → ContentHandler
  35. def resolveEntity(arg0: String, arg1: String): org.xml.sax.InputSource
    Definition Classes
    XMLFilterImpl → EntityResolver
    Annotations
    @throws( classOf[java.io.IOException] ) @throws( classOf[org.xml.sax.SAXException] )
  36. def setContentHandler(arg0: ContentHandler): Unit
    Definition Classes
    XMLFilterImpl → XMLReader
  37. def setDTDHandler(arg0: DTDHandler): Unit
    Definition Classes
    XMLFilterImpl → XMLReader
  38. def setDocumentLocator(locator: Locator): Unit
    Definition Classes
    XIncludeFilter → XMLFilterImpl → ContentHandler
  39. def setEntityResolver(arg0: org.xml.sax.EntityResolver): Unit
    Definition Classes
    XMLFilterImpl → XMLReader
  40. def setErrorHandler(arg0: ErrorHandler): Unit
    Definition Classes
    XMLFilterImpl → XMLReader
  41. def setFeature(arg0: String, arg1: Boolean): Unit
    Definition Classes
    XMLFilterImpl → XMLReader
    Annotations
    @throws( ... ) @throws( ... )
  42. def setParent(arg0: XMLReader): Unit
    Definition Classes
    XMLFilterImpl → XMLFilter
  43. def setProperty(arg0: String, arg1: Any): Unit
    Definition Classes
    XMLFilterImpl → XMLReader
    Annotations
    @throws( ... ) @throws( ... )
  44. def skippedEntity(name: String): Unit
    Definition Classes
    XIncludeFilter → XMLFilterImpl → ContentHandler
  45. def startDocument(): Unit
    Definition Classes
    XIncludeFilter → XMLFilterImpl → ContentHandler
  46. def startElement(uri: String, localName: String, qName: String, atts1: Attributes): Unit
    Definition Classes
    XIncludeFilter → XMLFilterImpl → ContentHandler
  47. def startPrefixMapping(prefix: String, uri: String): Unit
    Definition Classes
    XIncludeFilter → XMLFilterImpl → ContentHandler
  48. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  49. def toString(): String
    Definition Classes
    AnyRef → Any
  50. def unparsedEntityDecl(arg0: String, arg1: String, arg2: String, arg3: String): Unit
    Definition Classes
    XMLFilterImpl → DTDHandler
    Annotations
    @throws( classOf[org.xml.sax.SAXException] )
  51. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  52. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  53. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  54. def warning(arg0: org.xml.sax.SAXParseException): Unit
    Definition Classes
    XMLFilterImpl → ErrorHandler
    Annotations
    @throws( classOf[org.xml.sax.SAXException] )

Inherited from XMLFilterImpl

Inherited from ErrorHandler

Inherited from ContentHandler

Inherited from DTDHandler

Inherited from XMLFilter

Inherited from XMLReader

Inherited from AnyRef

Inherited from Any

Ungrouped