scala.xml.include.sax
class XIncludeFilter

[source: `scala/xml/include/sax/XIncludeFilter.scala`]

`` `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 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.
  5. Pass the URL of the document to read to this object's `parse()` method

  e.g.

      XIncludeFilter 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

Author
  Burak Emir

Value Summary
`final val` | XINCLUDE_NAMESPACE : java.lang.String = "http://www.w3.org/2001/XInclude"

Method Summary
`override def` | characters (ch : Array[Char], start : Int, length : Int) : Unit
`override def` | endDocument : Unit
`override def` | endElement (uri : java.lang.String, localName : java.lang.String, qName : java.lang.String) : Unit
`override def` | endPrefixMapping (prefix : java.lang.String) : Unit
`override def` | ignorableWhitespace (ch : Array[Char], start : Int, length : Int) : Unit
`def` | insideIncludeElement : Boolean 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.
`override def` | processingInstruction (target : java.lang.String, data : java.lang.String) : Unit
`override def` | setDocumentLocator (locator : org.xml.sax.Locator) : Unit
`override def` | skippedEntity (name : java.lang.String) : Unit
`override def` | startDocument : Unit
`override def` | startElement (uri : java.lang.String, localName : java.lang.String, qName : java.lang.String, atts1 : org.xml.sax.Attributes) : Unit
`override def` | startPrefixMapping (prefix : java.lang.String, uri : java.lang.String) : Unit

Methods inherited from org.xml.sax.helpers.XMLFilterImpl
org.xml.sax.helpers.XMLFilterImpl.setParent, org.xml.sax.helpers.XMLFilterImpl.getParent, org.xml.sax.helpers.XMLFilterImpl.setFeature, org.xml.sax.helpers.XMLFilterImpl.getFeature, org.xml.sax.helpers.XMLFilterImpl.setProperty, org.xml.sax.helpers.XMLFilterImpl.getProperty, org.xml.sax.helpers.XMLFilterImpl.setEntityResolver, org.xml.sax.helpers.XMLFilterImpl.getEntityResolver, org.xml.sax.helpers.XMLFilterImpl.setDTDHandler, org.xml.sax.helpers.XMLFilterImpl.getDTDHandler, org.xml.sax.helpers.XMLFilterImpl.setContentHandler, org.xml.sax.helpers.XMLFilterImpl.getContentHandler, org.xml.sax.helpers.XMLFilterImpl.setErrorHandler, org.xml.sax.helpers.XMLFilterImpl.getErrorHandler, org.xml.sax.helpers.XMLFilterImpl.parse, org.xml.sax.helpers.XMLFilterImpl.parse, org.xml.sax.helpers.XMLFilterImpl.resolveEntity, org.xml.sax.helpers.XMLFilterImpl.notationDecl, org.xml.sax.helpers.XMLFilterImpl.unparsedEntityDecl, org.xml.sax.helpers.XMLFilterImpl.warning, org.xml.sax.helpers.XMLFilterImpl.error, org.xml.sax.helpers.XMLFilterImpl.fatalError

Methods inherited from AnyRef
getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized

Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf

Value Details

`final` `val` XINCLUDE_NAMESPACE : java.lang.String

Method Details

`override` `def` setDocumentLocator(locator : org.xml.sax.Locator) : Unit

Overrides
  org.xml.sax.helpers.XMLFilterImpl.org.xml.sax.helpers.XMLFilterImpl.setDocumentLocator

`` `def` insideIncludeElement : Boolean

  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

`override` `def` startElement(uri : java.lang.String, localName : java.lang.String, qName : java.lang.String, atts1 : org.xml.sax.Attributes) : Unit

Overrides
  org.xml.sax.helpers.XMLFilterImpl.org.xml.sax.helpers.XMLFilterImpl.startElement

`override` `def` endElement(uri : java.lang.String, localName : java.lang.String, qName : java.lang.String) : Unit

Overrides
  org.xml.sax.helpers.XMLFilterImpl.org.xml.sax.helpers.XMLFilterImpl.endElement

`override` `def` startDocument : Unit

Overrides
  org.xml.sax.helpers.XMLFilterImpl.org.xml.sax.helpers.XMLFilterImpl.startDocument

`override` `def` endDocument : Unit

Overrides
  org.xml.sax.helpers.XMLFilterImpl.org.xml.sax.helpers.XMLFilterImpl.endDocument

`override` `def` startPrefixMapping(prefix : java.lang.String, uri : java.lang.String) : Unit

Overrides
  org.xml.sax.helpers.XMLFilterImpl.org.xml.sax.helpers.XMLFilterImpl.startPrefixMapping

`override` `def` endPrefixMapping(prefix : java.lang.String) : Unit

Overrides
  org.xml.sax.helpers.XMLFilterImpl.org.xml.sax.helpers.XMLFilterImpl.endPrefixMapping

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

Overrides
  org.xml.sax.helpers.XMLFilterImpl.org.xml.sax.helpers.XMLFilterImpl.characters

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

Overrides
  org.xml.sax.helpers.XMLFilterImpl.org.xml.sax.helpers.XMLFilterImpl.ignorableWhitespace

`override` `def` processingInstruction(target : java.lang.String, data : java.lang.String) : Unit

Overrides
  org.xml.sax.helpers.XMLFilterImpl.org.xml.sax.helpers.XMLFilterImpl.processingInstruction

`override` `def` skippedEntity(name : java.lang.String) : Unit

Overrides
  org.xml.sax.helpers.XMLFilterImpl.org.xml.sax.helpers.XMLFilterImpl.skippedEntity