Scala 2.6.1-final

API Specification

This document is the API specification for Scala Library Documentation

Class Summary
class XIncludeFilter extends org.xml.sax.helpers.XMLFilterImpl with AnyRef

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 a horizontal chain of filters, not a vertical hierarchy of sub and superclasses.

To use this class:

  1. Construct an XIncludeFilter object with a known base URL
  2. Pass the XMLReader object from which the raw document will be read to the setParent() method of this object.
  3. 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.
  4. Optional: if you wish to receive comments, set your own LexicalHandler object as the value of this object's property. Also make sure your LexicalHandler asks this object for the status of each comment using insideIncludeElement before doing anything with the comment.
  5. Pass the URL of the document to read to this object's parse() method


XIncludeFilter includer = new XIncludeFilter(base); 
  includer.setContentHandler(new SAXXIncluder(System.out));

translated from Elliotte Rusty Harold's Java source
class XIncluder (outs :, encoding : java.lang.String) extends org.xml.sax.ContentHandler with org.xml.sax.ext.LexicalHandler with AnyRef
XIncluder is a SAX ContentHandler that writes its XML document onto an output stream after resolving all xinclude:include elements.

based on Eliotte Rusty Harold's SAXXIncluder

Object Summary
object EncodingHeuristics extends AnyRef

EncodingHeuristics reads from a stream (which should be buffered) and attempts to guess what the encoding of the text in the stream is. Byte order marks are stripped from the stream. If it fails to determine the type of the encoding, it returns the default UTF-8.

Translated from Elliotte Rusty Harold's Java source

object Main extends AnyRef