gnu.xml.pipeline
Class XIncludeFilter

java.lang.Object
  extended bygnu.xml.pipeline.EventFilter
      extended bygnu.xml.pipeline.XIncludeFilter
All Implemented Interfaces:
ContentHandler, 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 16-May-2001 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().

TBD: "IURI" handling.

Version:
$Date: 2001/10/25 07:32:04 $
Author:
David Brownell

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(char[] ch, int start, int length)
          SAX2: passes this callback to the next consumer, if any
 void comment(char[] 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(java.lang.String uri, java.lang.String localName, java.lang.String qName)
          SAX2: passes this callback to the next consumer, if any
 void endEntity(java.lang.String name)
          SAX2: passes this callback to the next consumer, if any.
 void endPrefixMapping(java.lang.String prefix)
          SAX2: passes this callback to the next consumer, if any
 void externalEntityDecl(java.lang.String name, java.lang.String publicId, java.lang.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.
 java.lang.String getPublicId()
          Used for proxy locator; do not call directly.
 java.lang.String getSystemId()
          Used for proxy locator; do not call directly.
 void ignorableWhitespace(char[] 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(java.lang.String target, java.lang.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(java.lang.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(java.lang.String uri, java.lang.String localName, java.lang.String qName, Attributes atts)
          SAX2: passes this callback to the next consumer, if any
 void startEntity(java.lang.String name)
          SAX2: passes this callback to the next consumer, if any.
 void startPrefixMapping(java.lang.String prefix, java.lang.String uri)
          SAX2: passes this callback to the next consumer, if any
 
Methods inherited from class gnu.xml.pipeline.EventFilter
attributeDecl, bind, chainTo, elementDecl, endDTD, getContentHandler, getDocumentLocator, getDTDHandler, getErrorHandler, getNext, getProperty, internalEntityDecl, notationDecl, setContentHandler, setDTDHandler, setErrorHandler, setProperty, startDTD, unparsedEntityDecl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XIncludeFilter

public XIncludeFilter(EventConsumer next)
               throws SAXException
Method Detail

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 class EventFilter

getSystemId

public java.lang.String getSystemId()
Used for proxy locator; do not call directly.

Specified by:
getSystemId in interface Locator
Returns:
A string containing the system identifier, or null if none is available.
See Also:
Locator.getPublicId()

getPublicId

public java.lang.String getPublicId()
Used for proxy locator; do not call directly.

Specified by:
getPublicId in interface Locator
Returns:
A string containing the public identifier, or null if none is available.
See Also:
Locator.getSystemId()

getLineNumber

public int getLineNumber()
Used for proxy locator; do not call directly.

Specified by:
getLineNumber in interface Locator
Returns:
The line number, or -1 if none is available.
See Also:
Locator.getColumnNumber()

getColumnNumber

public int getColumnNumber()
Used for proxy locator; do not call directly.

Specified by:
getColumnNumber in interface Locator
Returns:
The column number, or -1 if none is available.
See Also:
Locator.getLineNumber()

setSavingPrefixes

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


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.


startDocument

public void startDocument()
                   throws SAXException
Description copied from class: EventFilter
SAX2: passes this callback to the next consumer, if any

Specified by:
startDocument in interface ContentHandler
Overrides:
startDocument in class EventFilter
Throws:
SAXException

endDocument

public void endDocument()
                 throws SAXException
Description copied from class: EventFilter
SAX2: passes this callback to the next consumer, if any

Specified by:
endDocument in interface ContentHandler
Overrides:
endDocument in class EventFilter
Throws:
SAXException

externalEntityDecl

public void externalEntityDecl(java.lang.String name,
                               java.lang.String publicId,
                               java.lang.String systemId)
                        throws SAXException
Description copied from class: EventFilter
SAX2: passes this callback to the next consumer, if any

Specified by:
externalEntityDecl in interface DeclHandler
Overrides:
externalEntityDecl in class EventFilter
Throws:
SAXException

startEntity

public void startEntity(java.lang.String name)
                 throws SAXException
Description copied from class: EventFilter
SAX2: passes this callback to the next consumer, if any.

Specified by:
startEntity in interface LexicalHandler
Overrides:
startEntity in class EventFilter
Throws:
SAXException

endEntity

public void endEntity(java.lang.String name)
               throws SAXException
Description copied from class: EventFilter
SAX2: passes this callback to the next consumer, if any.

Specified by:
endEntity in interface LexicalHandler
Overrides:
endEntity in class EventFilter
Throws:
SAXException

startElement

public void startElement(java.lang.String uri,
                         java.lang.String localName,
                         java.lang.String qName,
                         Attributes atts)
                  throws SAXException
Description copied from class: EventFilter
SAX2: passes this callback to the next consumer, if any

Specified by:
startElement in interface ContentHandler
Overrides:
startElement in class EventFilter
Throws:
SAXException

endElement

public void endElement(java.lang.String uri,
                       java.lang.String localName,
                       java.lang.String qName)
                throws SAXException
Description copied from class: EventFilter
SAX2: passes this callback to the next consumer, if any

Specified by:
endElement in interface ContentHandler
Overrides:
endElement in class EventFilter
Throws:
SAXException

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws SAXException
Description copied from class: EventFilter
SAX2: passes this callback to the next consumer, if any

Specified by:
characters in interface ContentHandler
Overrides:
characters in class EventFilter
Throws:
SAXException

processingInstruction

public void processingInstruction(java.lang.String target,
                                  java.lang.String value)
                           throws SAXException
Description copied from class: EventFilter
SAX2: passes this callback to the next consumer, if any

Specified by:
processingInstruction in interface ContentHandler
Overrides:
processingInstruction in class EventFilter
Throws:
SAXException

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int length)
                         throws SAXException
Description copied from class: EventFilter
SAX2: passes this callback to the next consumer, if any

Specified by:
ignorableWhitespace in interface ContentHandler
Overrides:
ignorableWhitespace in class EventFilter
Throws:
SAXException

comment

public void comment(char[] ch,
                    int start,
                    int length)
             throws SAXException
Description copied from class: EventFilter
SAX2: passes this callback to the next consumer, if any

Specified by:
comment in interface LexicalHandler
Overrides:
comment in class EventFilter
Throws:
SAXException

startCDATA

public void startCDATA()
                throws SAXException
Description copied from class: EventFilter
SAX2: passes this callback to the next consumer, if any

Specified by:
startCDATA in interface LexicalHandler
Overrides:
startCDATA in class EventFilter
Throws:
SAXException

endCDATA

public void endCDATA()
              throws SAXException
Description copied from class: EventFilter
SAX2: passes this callback to the next consumer, if any

Specified by:
endCDATA in interface LexicalHandler
Overrides:
endCDATA in class EventFilter
Throws:
SAXException

startPrefixMapping

public void startPrefixMapping(java.lang.String prefix,
                               java.lang.String uri)
                        throws SAXException
Description copied from class: EventFilter
SAX2: passes this callback to the next consumer, if any

Specified by:
startPrefixMapping in interface ContentHandler
Overrides:
startPrefixMapping in class EventFilter
Throws:
SAXException

endPrefixMapping

public void endPrefixMapping(java.lang.String prefix)
                      throws SAXException
Description copied from class: EventFilter
SAX2: passes this callback to the next consumer, if any

Specified by:
endPrefixMapping in interface ContentHandler
Overrides:
endPrefixMapping in class EventFilter
Throws:
SAXException

skippedEntity

public void skippedEntity(java.lang.String name)
                   throws SAXException
Description copied from class: EventFilter
SAX2: passes this callback to the next consumer, if any

Specified by:
skippedEntity in interface ContentHandler
Overrides:
skippedEntity in class EventFilter
Throws:
SAXException


Source code is under GPL (with library exception) in the JAXP project at http://www.gnu.org/software/classpathx/jaxp
This documentation was derived from that source code on 2008-04-13.