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:
- 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 thesetParent()
method of this object. - Pass your own
ContentHandler
object to thesetContentHandler()
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'shttp://xml.org/sax/properties/lexical-handler
property. Also make sure yourLexicalHandler
asks this object for the status of each comment usinginsideIncludeElement
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.
- Alphabetic
- By Inheritance
- XIncludeFilter
- XMLFilterImpl
- ErrorHandler
- ContentHandler
- DTDHandler
- EntityResolver
- XMLFilter
- XMLReader
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new XIncludeFilter()
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final val XINCLUDE_NAMESPACE: String("http://www.w3.org/2001/XInclude")
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
characters(ch: Array[Char], start: Int, length: Int): Unit
- Definition Classes
- XIncludeFilter → XMLFilterImpl → ContentHandler
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
def
endDocument(): Unit
- Definition Classes
- XIncludeFilter → XMLFilterImpl → ContentHandler
-
def
endElement(uri: String, localName: String, qName: String): Unit
- Definition Classes
- XIncludeFilter → XMLFilterImpl → ContentHandler
-
def
endPrefixMapping(prefix: String): Unit
- Definition Classes
- XIncludeFilter → XMLFilterImpl → ContentHandler
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
error(arg0: org.xml.sax.SAXParseException): Unit
- Definition Classes
- XMLFilterImpl → ErrorHandler
- Annotations
- @throws( classOf[org.xml.sax.SAXException] )
-
def
fatalError(arg0: org.xml.sax.SAXParseException): Unit
- Definition Classes
- XMLFilterImpl → ErrorHandler
- Annotations
- @throws( classOf[org.xml.sax.SAXException] )
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
getContentHandler(): ContentHandler
- Definition Classes
- XMLFilterImpl → XMLReader
-
def
getDTDHandler(): DTDHandler
- Definition Classes
- XMLFilterImpl → XMLReader
-
def
getEntityResolver(): org.xml.sax.EntityResolver
- Definition Classes
- XMLFilterImpl → XMLReader
-
def
getErrorHandler(): ErrorHandler
- Definition Classes
- XMLFilterImpl → XMLReader
-
def
getFeature(arg0: String): Boolean
- Definition Classes
- XMLFilterImpl → XMLReader
- Annotations
- @throws( ... ) @throws( ... )
-
def
getParent(): XMLReader
- Definition Classes
- XMLFilterImpl → XMLFilter
-
def
getProperty(arg0: String): AnyRef
- Definition Classes
- XMLFilterImpl → XMLReader
- Annotations
- @throws( ... ) @throws( ... )
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
ignorableWhitespace(ch: Array[Char], start: Int, length: Int): Unit
- Definition Classes
- XIncludeFilter → XMLFilterImpl → ContentHandler
-
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
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
notationDecl(arg0: String, arg1: String, arg2: String): Unit
- Definition Classes
- XMLFilterImpl → DTDHandler
- Annotations
- @throws( classOf[org.xml.sax.SAXException] )
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
def
parse(arg0: String): Unit
- Definition Classes
- XMLFilterImpl → XMLReader
- Annotations
- @throws( classOf[java.io.IOException] ) @throws( classOf[org.xml.sax.SAXException] )
-
def
parse(arg0: org.xml.sax.InputSource): Unit
- Definition Classes
- XMLFilterImpl → XMLReader
- Annotations
- @throws( classOf[java.io.IOException] ) @throws( classOf[org.xml.sax.SAXException] )
-
def
processingInstruction(target: String, data: String): Unit
- Definition Classes
- XIncludeFilter → XMLFilterImpl → ContentHandler
-
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] )
-
def
setContentHandler(arg0: ContentHandler): Unit
- Definition Classes
- XMLFilterImpl → XMLReader
-
def
setDTDHandler(arg0: DTDHandler): Unit
- Definition Classes
- XMLFilterImpl → XMLReader
-
def
setDocumentLocator(locator: Locator): Unit
- Definition Classes
- XIncludeFilter → XMLFilterImpl → ContentHandler
-
def
setEntityResolver(arg0: org.xml.sax.EntityResolver): Unit
- Definition Classes
- XMLFilterImpl → XMLReader
-
def
setErrorHandler(arg0: ErrorHandler): Unit
- Definition Classes
- XMLFilterImpl → XMLReader
-
def
setFeature(arg0: String, arg1: Boolean): Unit
- Definition Classes
- XMLFilterImpl → XMLReader
- Annotations
- @throws( ... ) @throws( ... )
-
def
setParent(arg0: XMLReader): Unit
- Definition Classes
- XMLFilterImpl → XMLFilter
-
def
setProperty(arg0: String, arg1: Any): Unit
- Definition Classes
- XMLFilterImpl → XMLReader
- Annotations
- @throws( ... ) @throws( ... )
-
def
skippedEntity(name: String): Unit
- Definition Classes
- XIncludeFilter → XMLFilterImpl → ContentHandler
-
def
startDocument(): Unit
- Definition Classes
- XIncludeFilter → XMLFilterImpl → ContentHandler
-
def
startElement(uri: String, localName: String, qName: String, atts1: Attributes): Unit
- Definition Classes
- XIncludeFilter → XMLFilterImpl → ContentHandler
-
def
startPrefixMapping(prefix: String, uri: String): Unit
- Definition Classes
- XIncludeFilter → XMLFilterImpl → ContentHandler
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
def
unparsedEntityDecl(arg0: String, arg1: String, arg2: String, arg3: String): Unit
- Definition Classes
- XMLFilterImpl → DTDHandler
- Annotations
- @throws( classOf[org.xml.sax.SAXException] )
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
def
warning(arg0: org.xml.sax.SAXParseException): Unit
- Definition Classes
- XMLFilterImpl → ErrorHandler
- Annotations
- @throws( classOf[org.xml.sax.SAXException] )