Packages

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.

Linear Supertypes
XMLFilterImpl, ErrorHandler, ContentHandler, DTDHandler, org.xml.sax.EntityResolver, XMLFilter, XMLReader, AnyRef, Any
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 val XINCLUDE_NAMESPACE: String("http://www.w3.org/2001/XInclude")
  2. def characters(ch: Array[Char], start: Int, length: Int): Unit
    Definition Classes
    XIncludeFilter → XMLFilterImpl → ContentHandler
  3. def endDocument(): Unit
    Definition Classes
    XIncludeFilter → XMLFilterImpl → ContentHandler
  4. def endElement(uri: String, localName: String, qName: String): Unit
    Definition Classes
    XIncludeFilter → XMLFilterImpl → ContentHandler
  5. def endPrefixMapping(prefix: String): Unit
    Definition Classes
    XIncludeFilter → XMLFilterImpl → ContentHandler
  6. def error(arg0: org.xml.sax.SAXParseException): Unit
    Definition Classes
    XMLFilterImpl → ErrorHandler
    Annotations
    @throws( classOf[org.xml.sax.SAXException] )
  7. def fatalError(arg0: org.xml.sax.SAXParseException): Unit
    Definition Classes
    XMLFilterImpl → ErrorHandler
    Annotations
    @throws( classOf[org.xml.sax.SAXException] )
  8. def getContentHandler(): ContentHandler
    Definition Classes
    XMLFilterImpl → XMLReader
  9. def getDTDHandler(): DTDHandler
    Definition Classes
    XMLFilterImpl → XMLReader
  10. def getEntityResolver(): org.xml.sax.EntityResolver
    Definition Classes
    XMLFilterImpl → XMLReader
  11. def getErrorHandler(): ErrorHandler
    Definition Classes
    XMLFilterImpl → XMLReader
  12. def getFeature(arg0: String): Boolean
    Definition Classes
    XMLFilterImpl → XMLReader
    Annotations
    @throws( ... ) @throws( ... )
  13. def getParent(): XMLReader
    Definition Classes
    XMLFilterImpl → XMLFilter
  14. def getProperty(arg0: String): AnyRef
    Definition Classes
    XMLFilterImpl → XMLReader
    Annotations
    @throws( ... ) @throws( ... )
  15. def ignorableWhitespace(ch: Array[Char], start: Int, length: Int): Unit
    Definition Classes
    XIncludeFilter → XMLFilterImpl → ContentHandler
  16. 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

  17. def notationDecl(arg0: String, arg1: String, arg2: String): Unit
    Definition Classes
    XMLFilterImpl → DTDHandler
    Annotations
    @throws( classOf[org.xml.sax.SAXException] )
  18. def parse(arg0: String): Unit
    Definition Classes
    XMLFilterImpl → XMLReader
    Annotations
    @throws( classOf[java.io.IOException] ) @throws( classOf[org.xml.sax.SAXException] )
  19. def parse(arg0: org.xml.sax.InputSource): Unit
    Definition Classes
    XMLFilterImpl → XMLReader
    Annotations
    @throws( classOf[java.io.IOException] ) @throws( classOf[org.xml.sax.SAXException] )
  20. def processingInstruction(target: String, data: String): Unit
    Definition Classes
    XIncludeFilter → XMLFilterImpl → ContentHandler
  21. 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] )
  22. def setContentHandler(arg0: ContentHandler): Unit
    Definition Classes
    XMLFilterImpl → XMLReader
  23. def setDTDHandler(arg0: DTDHandler): Unit
    Definition Classes
    XMLFilterImpl → XMLReader
  24. def setDocumentLocator(locator: Locator): Unit
    Definition Classes
    XIncludeFilter → XMLFilterImpl → ContentHandler
  25. def setEntityResolver(arg0: org.xml.sax.EntityResolver): Unit
    Definition Classes
    XMLFilterImpl → XMLReader
  26. def setErrorHandler(arg0: ErrorHandler): Unit
    Definition Classes
    XMLFilterImpl → XMLReader
  27. def setFeature(arg0: String, arg1: Boolean): Unit
    Definition Classes
    XMLFilterImpl → XMLReader
    Annotations
    @throws( ... ) @throws( ... )
  28. def setParent(arg0: XMLReader): Unit
    Definition Classes
    XMLFilterImpl → XMLFilter
  29. def setProperty(arg0: String, arg1: Any): Unit
    Definition Classes
    XMLFilterImpl → XMLReader
    Annotations
    @throws( ... ) @throws( ... )
  30. def skippedEntity(name: String): Unit
    Definition Classes
    XIncludeFilter → XMLFilterImpl → ContentHandler
  31. def startDocument(): Unit
    Definition Classes
    XIncludeFilter → XMLFilterImpl → ContentHandler
  32. def startElement(uri: String, localName: String, qName: String, atts1: Attributes): Unit
    Definition Classes
    XIncludeFilter → XMLFilterImpl → ContentHandler
  33. def startPrefixMapping(prefix: String, uri: String): Unit
    Definition Classes
    XIncludeFilter → XMLFilterImpl → ContentHandler
  34. def unparsedEntityDecl(arg0: String, arg1: String, arg2: String, arg3: String): Unit
    Definition Classes
    XMLFilterImpl → DTDHandler
    Annotations
    @throws( classOf[org.xml.sax.SAXException] )
  35. def warning(arg0: org.xml.sax.SAXParseException): Unit
    Definition Classes
    XMLFilterImpl → ErrorHandler
    Annotations
    @throws( classOf[org.xml.sax.SAXException] )