gnu.xml.pipeline

Class XIncludeFilter

Implemented Interfaces:
ContentHandler, ContentHandler2, DeclHandler, DTDHandler, EventConsumer, LexicalHandler, Locator

public class XIncludeFilter
extends EventFilter
implements Locator

Filter to process an XPointer-free subset of XInclude, supporting its use as a kind of replacement for parsed general entities. XInclude works much like the #include of C/C++ but works for XML documents as well as unparsed text files. Restrictions from the 17-Sept-2002 CR draft of XInclude are as follows:

XML documents that are included will normally be processed using the default SAX namespace rules, meaning that prefix information may be discarded. This may be changed with setSavingPrefixes(). You are strongly advised to do this.

Note that XInclude allows highly incompatible implementations, which are specialized to handle application-specific infoset extensions. Some such implementations can be implemented by subclassing this one, but they may only be substituted in applications at "user option".

TBD: "IURI" handling.

Field Summary

Fields inherited from class gnu.xml.pipeline.EventFilter

DECL_HANDLER, FEATURE_URI, LEXICAL_HANDLER, PROPERTY_URI

Constructor Summary

XIncludeFilter(EventConsumer next)

Method Summary

void
characters(ch[] , int start, int length)
SAX2: passes this callback to the next consumer, if any
void
comment(ch[] , int start, int length)
SAX2: passes this callback to the next consumer, if any
void
endCDATA()
SAX2: passes this callback to the next consumer, if any
void
endDocument()
SAX2: passes this callback to the next consumer, if any
void
endElement(String uri, String localName, String qName)
SAX2: passes this callback to the next consumer, if any
void
endEntity(String name)
SAX2: passes this callback to the next consumer, if any.
void
endPrefixMapping(String prefix)
SAX2: passes this callback to the next consumer, if any
void
externalEntityDecl(String name, String publicId, String systemId)
SAX2: passes this callback to the next consumer, if any
int
getColumnNumber()
Used for proxy locator; do not call directly.
int
getLineNumber()
Used for proxy locator; do not call directly.
String
getPublicId()
Used for proxy locator; do not call directly.
String
getSystemId()
Used for proxy locator; do not call directly.
void
ignorableWhitespace(ch[] , int start, int length)
SAX2: passes this callback to the next consumer, if any
boolean
isSavingPrefixes()
Returns the flag controlling the setting of the SAX2 namespace-prefixes flag when parsing included documents.
void
processingInstruction(String target, String value)
SAX2: passes this callback to the next consumer, if any
void
setDocumentLocator(Locator locator)
Passes "this" down the filter chain as a proxy locator.
void
setSavingPrefixes(boolean flag)
Assigns the flag controlling the setting of the SAX2 namespace-prefixes flag.
void
skippedEntity(String name)
SAX2: passes this callback to the next consumer, if any
void
startCDATA()
SAX2: passes this callback to the next consumer, if any
void
startDocument()
SAX2: passes this callback to the next consumer, if any
void
startElement(String uri, String localName, String qName, Attributes atts)
SAX2: passes this callback to the next consumer, if any
void
startEntity(String name)
SAX2: passes this callback to the next consumer, if any.
void
startPrefixMapping(String prefix, String uri)
SAX2: passes this callback to the next consumer, if any

Methods inherited from class gnu.xml.pipeline.EventFilter

attributeDecl, bind, chainTo, characters, comment, elementDecl, endCDATA, endDTD, endDocument, endElement, endEntity, endPrefixMapping, externalEntityDecl, getContentHandler, getDTDHandler, getDocumentLocator, getErrorHandler, getNext, getProperty, ignorableWhitespace, internalEntityDecl, notationDecl, processingInstruction, setContentHandler, setDTDHandler, setDocumentLocator, setErrorHandler, setProperty, skippedEntity, startCDATA, startDTD, startDocument, startElement, startEntity, startPrefixMapping, unparsedEntityDecl, xmlDecl

Constructor Details

XIncludeFilter

public XIncludeFilter(EventConsumer next)
            throws SAXException

Method Details

characters

public void characters(ch[] ,
                       int start,
                       int length)
            throws SAXException
SAX2: passes this callback to the next consumer, if any
Specified by:
characters in interface ContentHandler
Overrides:
characters in interface EventFilter


comment

public void comment(ch[] ,
                    int start,
                    int length)
            throws SAXException
SAX2: passes this callback to the next consumer, if any
Specified by:
comment in interface LexicalHandler
Overrides:
comment in interface EventFilter


endCDATA

public void endCDATA()
            throws SAXException
SAX2: passes this callback to the next consumer, if any
Specified by:
endCDATA in interface LexicalHandler
Overrides:
endCDATA in interface EventFilter


endDocument

public void endDocument()
            throws SAXException
SAX2: passes this callback to the next consumer, if any
Specified by:
endDocument in interface ContentHandler
Overrides:
endDocument in interface EventFilter


endElement

public void endElement(String uri,
                       String localName,
                       String qName)
            throws SAXException
SAX2: passes this callback to the next consumer, if any
Specified by:
endElement in interface ContentHandler
Overrides:
endElement in interface EventFilter


endEntity

public void endEntity(String name)
            throws SAXException
SAX2: passes this callback to the next consumer, if any.
Specified by:
endEntity in interface LexicalHandler
Overrides:
endEntity in interface EventFilter


endPrefixMapping

public void endPrefixMapping(String prefix)
            throws SAXException
SAX2: passes this callback to the next consumer, if any
Specified by:
endPrefixMapping in interface ContentHandler
Overrides:
endPrefixMapping in interface EventFilter


externalEntityDecl

public void externalEntityDecl(String name,
                               String publicId,
                               String systemId)
            throws SAXException
SAX2: passes this callback to the next consumer, if any
Specified by:
externalEntityDecl in interface DeclHandler
Overrides:
externalEntityDecl in interface EventFilter


getColumnNumber

public int getColumnNumber()
Used for proxy locator; do not call directly.
Specified by:
getColumnNumber in interface Locator


getLineNumber

public int getLineNumber()
Used for proxy locator; do not call directly.
Specified by:
getLineNumber in interface Locator


getPublicId

public String getPublicId()
Used for proxy locator; do not call directly.
Specified by:
getPublicId in interface Locator


getSystemId

public String getSystemId()
Used for proxy locator; do not call directly.
Specified by:
getSystemId in interface Locator


ignorableWhitespace

public void ignorableWhitespace(ch[] ,
                                int start,
                                int length)
            throws SAXException
SAX2: passes this callback to the next consumer, if any
Specified by:
ignorableWhitespace in interface ContentHandler
Overrides:
ignorableWhitespace in interface EventFilter


isSavingPrefixes

public boolean isSavingPrefixes()
Returns the flag controlling the setting of the SAX2 namespace-prefixes flag when parsing included documents. The default value is the SAX2 default (false), which discards information that can be useful.


processingInstruction

public void processingInstruction(String target,
                                  String value)
            throws SAXException
SAX2: passes this callback to the next consumer, if any
Specified by:
processingInstruction in interface ContentHandler
Overrides:
processingInstruction in interface EventFilter


setDocumentLocator

public void setDocumentLocator(Locator locator)
Passes "this" down the filter chain as a proxy locator.
Specified by:
setDocumentLocator in interface ContentHandler
Overrides:
setDocumentLocator in interface EventFilter


setSavingPrefixes

public void setSavingPrefixes(boolean flag)
Assigns the flag controlling the setting of the SAX2 namespace-prefixes flag.


skippedEntity

public void skippedEntity(String name)
            throws SAXException
SAX2: passes this callback to the next consumer, if any
Specified by:
skippedEntity in interface ContentHandler
Overrides:
skippedEntity in interface EventFilter


startCDATA

public void startCDATA()
            throws SAXException
SAX2: passes this callback to the next consumer, if any
Specified by:
startCDATA in interface LexicalHandler
Overrides:
startCDATA in interface EventFilter


startDocument

public void startDocument()
            throws SAXException
SAX2: passes this callback to the next consumer, if any
Specified by:
startDocument in interface ContentHandler
Overrides:
startDocument in interface EventFilter


startElement

public void startElement(String uri,
                         String localName,
                         String qName,
                         Attributes atts)
            throws SAXException
SAX2: passes this callback to the next consumer, if any
Specified by:
startElement in interface ContentHandler
Overrides:
startElement in interface EventFilter


startEntity

public void startEntity(String name)
            throws SAXException
SAX2: passes this callback to the next consumer, if any.
Specified by:
startEntity in interface LexicalHandler
Overrides:
startEntity in interface EventFilter


startPrefixMapping

public void startPrefixMapping(String prefix,
                               String uri)
            throws SAXException
SAX2: passes this callback to the next consumer, if any
Specified by:
startPrefixMapping in interface ContentHandler
Overrides:
startPrefixMapping in interface EventFilter