XIncludeFilter

scala.xml.include.sax.XIncludeFilter

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.

Attributes

Graph
Supertypes
trait ErrorHandler
trait DTDHandler
trait XMLFilter
trait XMLReader
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

override def characters(ch: Array[Char], start: Int, length: Int): Unit

Attributes

Definition Classes
override def endDocument(): Unit

Attributes

Definition Classes
override def endElement(uri: String, localName: String, qName: String): Unit

Attributes

Definition Classes
override def endPrefixMapping(prefix: String): Unit

Attributes

Definition Classes
override def ignorableWhitespace(ch: Array[Char], start: Int, length: Int): Unit

Attributes

Definition Classes

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.

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.

Attributes

Returns

boolean

override def processingInstruction(target: String, data: String): Unit

Attributes

Definition Classes
override def setDocumentLocator(locator: Locator): Unit

Attributes

Definition Classes
override def skippedEntity(name: String): Unit

Attributes

Definition Classes
override def startDocument(): Unit

Attributes

Definition Classes
override def startElement(uri: String, localName: String, qName: String, atts1: Attributes): Unit

Attributes

Definition Classes
override def startPrefixMapping(prefix: String, uri: String): Unit

Attributes

Definition Classes

Inherited methods

Attributes

Inherited from:
XMLFilterImpl

Attributes

Inherited from:
XMLFilterImpl

Attributes

Inherited from:
XMLFilterImpl

Attributes

Inherited from:
XMLFilterImpl

Attributes

Inherited from:
XMLFilterImpl

Attributes

Inherited from:
XMLFilterImpl

Attributes

Inherited from:
XMLFilterImpl

Attributes

Inherited from:
XMLFilterImpl
def getProperty(x$0: String): <FromJavaObject>

Attributes

Inherited from:
XMLFilterImpl

Attributes

Inherited from:
XMLFilterImpl
def parse(x$0: String): Unit

Attributes

Inherited from:
XMLFilterImpl

Attributes

Inherited from:
XMLFilterImpl

Attributes

Inherited from:
XMLFilterImpl

Attributes

Inherited from:
XMLFilterImpl

Attributes

Inherited from:
XMLFilterImpl

Attributes

Inherited from:
XMLFilterImpl

Attributes

Inherited from:
XMLFilterImpl

Attributes

Inherited from:
XMLFilterImpl

Attributes

Inherited from:
XMLFilterImpl
def setProperty(x$0: String, x$1: <FromJavaObject>): Unit

Attributes

Inherited from:
XMLFilterImpl

Attributes

Inherited from:
XMLFilterImpl

Attributes

Inherited from:
XMLFilterImpl

Concrete fields