Package

scala.xml.include

sax

Permalink

package sax

Visibility
  1. Public
  2. All

Type Members

  1. class XIncludeFilter extends XMLFilterImpl

    Permalink

    This is a SAX filter which resolves all XInclude include elements before passing them on to the client application.

    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.

  2. class XIncluder extends ContentHandler with LexicalHandler

    Permalink

    XIncluder is a SAX ContentHandler that writes its XML document onto an output stream after resolving all xinclude:include elements.

    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.

Value Members

  1. object EncodingHeuristics

    Permalink

    EncodingHeuristics reads from a stream (which should be buffered) and attempts to guess what the encoding of the text in the stream is.

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

Ungrouped