Movatterモバイル変換


[0]ホーム

URL:


         


Class XMLFilterImpl

java.lang.Object  |  +--org.xml.sax.helpers.XMLFilterImpl
All Implemented Interfaces:
ContentHandler,DTDHandler,EntityResolver,ErrorHandler,XMLFilter,XMLReader

public classXMLFilterImpl
extends java.lang.Object
implementsXMLFilter,EntityResolver,DTDHandler,ContentHandler,ErrorHandler

Base class for deriving an XML filter.

This module, both source code and documentation, is in the Public Domain, and comes withNO WARRANTY.

This class is designed to sit between anXMLReader and the client application's event handlers. By default, it does nothing but pass requests up to the reader and events on to the handlers unmodified, but subclasses can override specific methods to modify the event stream or the configuration requests as they pass through.

Since:
SAX 2.0
See Also:
XMLFilter,XMLReader,EntityResolver,DTDHandler,ContentHandler,ErrorHandler

XMLFilterImpl()
          Construct an empty XML filter, with no parent.
XMLFilterImpl(XMLReader parent)
          Construct an XML filter with the specified parent.
 
characters(char[] ch, int start, int length)
          Filter a character data event.
endDocument()
          Filter an end document event.
endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName)
          Filter an end element event.
endPrefixMapping(java.lang.String prefix)
          Filter an end Namespace prefix mapping event.
error(SAXParseException e)
          Filter an error event.
fatalError(SAXParseException e)
          Filter a fatal error event.
getContentHandler()
          Get the content event handler.
getDTDHandler()
          Get the current DTD event handler.
getEntityResolver()
          Get the current entity resolver.
getErrorHandler()
          Get the current error event handler.
getFeature(java.lang.String name)
          Look up the state of a feature.
getParent()
          Get the parent reader.
getProperty(java.lang.String name)
          Look up the value of a property.
ignorableWhitespace(char[] ch, int start, int length)
          Filter an ignorable whitespace event.
notationDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId)
          Filter a notation declaration event.
parse(InputSource input)
          Parse a document.
parse(java.lang.String systemId)
          Parse a document.
processingInstruction(java.lang.String target, java.lang.String data)
          Filter a processing instruction event.
resolveEntity(java.lang.String publicId, java.lang.String systemId)
          Filter an external entity resolution.
setContentHandler(ContentHandler handler)
          Set the content event handler.
setDocumentLocator(Locator locator)
          Filter a new document locator event.
setDTDHandler(DTDHandler handler)
          Set the DTD event handler.
setEntityResolver(EntityResolver resolver)
          Set the entity resolver.
setErrorHandler(ErrorHandler handler)
          Set the error event handler.
setFeature(java.lang.String name, boolean state)
          Set the state of a feature.
setParent(XMLReader parent)
          Set the parent reader.
setProperty(java.lang.String name, java.lang.Object value)
          Set the value of a property.
skippedEntity(java.lang.String name)
          Filter a skipped entity event.
startDocument()
          Filter a start document event.
startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName,Attributes atts)
          Filter a start element event.
startPrefixMapping(java.lang.String prefix, java.lang.String uri)
          Filter a start Namespace prefix mapping event.
unparsedEntityDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId, java.lang.String notationName)
          Filter an unparsed entity declaration event.
warning(SAXParseException e)
          Filter a warning event.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

XMLFilterImpl

publicXMLFilterImpl()
Construct an empty XML filter, with no parent.

This filter will have no parent: you must assign a parent before you start a parse or do any configuration with setFeature or setProperty.

See Also:
XMLReader.setFeature(java.lang.String, boolean),XMLReader.setProperty(java.lang.String, java.lang.Object)

XMLFilterImpl

publicXMLFilterImpl(XMLReader parent)
Construct an XML filter with the specified parent.
See Also:
setParent(org.xml.sax.XMLReader),getParent()

setParent

public voidsetParent(XMLReader parent)
Set the parent reader.

This is theXMLReader from which this filter will obtain its events and to which it will pass its configuration requests. The parent may itself be another filter.

If there is no parent reader set, any attempt to parse or to set or get a feature or property will fail.

Specified by:
setParent in interfaceXMLFilter
Parameters:
parent - The parent XML reader.
Throws:
java.lang.NullPointerException - If the parent is null.
See Also:
getParent()

getParent

publicXMLReadergetParent()
Get the parent reader.
Specified by:
getParent in interfaceXMLFilter
Returns:
The parent XML reader, or null if none is set.
See Also:
setParent(org.xml.sax.XMLReader)

setFeature

public voidsetFeature(java.lang.String name,                       boolean state)                throwsSAXNotRecognizedException,SAXNotSupportedException
Set the state of a feature.

This will always fail if the parent is null.

Specified by:
setFeature in interfaceXMLReader
Parameters:
name - The feature name.
state - The requested feature state.
Throws:
SAXNotRecognizedException - When the XMLReader does not recognize the feature name.
SAXNotSupportedException - When the XMLReader recognizes the feature name but cannot set the requested value.
See Also:
XMLReader.setFeature(java.lang.String, boolean)

getFeature

public booleangetFeature(java.lang.String name)                   throwsSAXNotRecognizedException,SAXNotSupportedException
Look up the state of a feature.

This will always fail if the parent is null.

Specified by:
getFeature in interfaceXMLReader
Parameters:
name - The feature name.
Returns:
The current state of the feature.
Throws:
SAXNotRecognizedException - When the XMLReader does not recognize the feature name.
SAXNotSupportedException - When the XMLReader recognizes the feature name but cannot determine its state at this time.
See Also:
XMLReader.getFeature(java.lang.String)

setProperty

public voidsetProperty(java.lang.String name,                        java.lang.Object value)                 throwsSAXNotRecognizedException,SAXNotSupportedException
Set the value of a property.

This will always fail if the parent is null.

Specified by:
setProperty in interfaceXMLReader
Parameters:
name - The property name.
state - The requested property value.
Throws:
SAXNotRecognizedException - When the XMLReader does not recognize the property name.
SAXNotSupportedException - When the XMLReader recognizes the property name but cannot set the requested value.
See Also:
XMLReader.setProperty(java.lang.String, java.lang.Object)

getProperty

public java.lang.ObjectgetProperty(java.lang.String name)                             throwsSAXNotRecognizedException,SAXNotSupportedException
Look up the value of a property.
Specified by:
getProperty in interfaceXMLReader
Parameters:
name - The property name.
Returns:
The current value of the property.
Throws:
SAXNotRecognizedException - When the XMLReader does not recognize the feature name.
SAXNotSupportedException - When the XMLReader recognizes the property name but cannot determine its value at this time.
See Also:
XMLReader.setFeature(java.lang.String, boolean)

setEntityResolver

public voidsetEntityResolver(EntityResolver resolver)
Set the entity resolver.
Specified by:
setEntityResolver in interfaceXMLReader
Parameters:
resolver - The new entity resolver.
Throws:
java.lang.NullPointerException - If the resolver is null.
See Also:
XMLReader.setEntityResolver(org.xml.sax.EntityResolver)

getEntityResolver

publicEntityResolvergetEntityResolver()
Get the current entity resolver.
Specified by:
getEntityResolver in interfaceXMLReader
Returns:
The current entity resolver, or null if none was set.
See Also:
XMLReader.getEntityResolver()

setDTDHandler

public voidsetDTDHandler(DTDHandler handler)
Set the DTD event handler.
Specified by:
setDTDHandler in interfaceXMLReader
Parameters:
resolver - The new DTD handler.
Throws:
java.lang.NullPointerException - If the handler is null.
See Also:
XMLReader.setDTDHandler(org.xml.sax.DTDHandler)

getDTDHandler

publicDTDHandlergetDTDHandler()
Get the current DTD event handler.
Specified by:
getDTDHandler in interfaceXMLReader
Returns:
The current DTD handler, or null if none was set.
See Also:
XMLReader.getDTDHandler()

setContentHandler

public voidsetContentHandler(ContentHandler handler)
Set the content event handler.
Specified by:
setContentHandler in interfaceXMLReader
Parameters:
resolver - The new content handler.
Throws:
java.lang.NullPointerException - If the handler is null.
See Also:
XMLReader.setContentHandler(org.xml.sax.ContentHandler)

getContentHandler

publicContentHandlergetContentHandler()
Get the content event handler.
Specified by:
getContentHandler in interfaceXMLReader
Returns:
The current content handler, or null if none was set.
See Also:
XMLReader.getContentHandler()

setErrorHandler

public voidsetErrorHandler(ErrorHandler handler)
Set the error event handler.
Specified by:
setErrorHandler in interfaceXMLReader
Parameters:
handle - The new error handler.
Throws:
java.lang.NullPointerException - If the handler is null.
See Also:
XMLReader.setErrorHandler(org.xml.sax.ErrorHandler)

getErrorHandler

publicErrorHandlergetErrorHandler()
Get the current error event handler.
Specified by:
getErrorHandler in interfaceXMLReader
Returns:
The current error handler, or null if none was set.
See Also:
XMLReader.getErrorHandler()

parse

public voidparse(InputSource input)           throwsSAXException,                  java.io.IOException
Parse a document.
Specified by:
parse in interfaceXMLReader
Parameters:
input - The input source for the document entity.
Throws:
SAXException - Any SAX exception, possibly wrapping another exception.
java.io.IOException - An IO exception from the parser, possibly from a byte stream or character stream supplied by the application.
See Also:
XMLReader.parse(org.xml.sax.InputSource)

parse

public voidparse(java.lang.String systemId)           throwsSAXException,                  java.io.IOException
Parse a document.
Specified by:
parse in interfaceXMLReader
Parameters:
systemId - The system identifier as a fully-qualified URI.
Throws:
SAXException - Any SAX exception, possibly wrapping another exception.
java.io.IOException - An IO exception from the parser, possibly from a byte stream or character stream supplied by the application.
See Also:
XMLReader.parse(java.lang.String)

resolveEntity

publicInputSourceresolveEntity(java.lang.String publicId,                                 java.lang.String systemId)                          throwsSAXException,                                 java.io.IOException
Filter an external entity resolution.
Specified by:
resolveEntity in interfaceEntityResolver
Parameters:
publicId - The entity's public identifier, or null.
systemId - The entity's system identifier.
Returns:
A new InputSource or null for the default.
Throws:
SAXException - The client may throw an exception during processing.
java.io.IOException - The client may throw an I/O-related exception while obtaining the new InputSource.
See Also:
EntityResolver.resolveEntity(java.lang.String, java.lang.String)

notationDecl

public voidnotationDecl(java.lang.String name,                         java.lang.String publicId,                         java.lang.String systemId)                  throwsSAXException
Filter a notation declaration event.
Specified by:
notationDecl in interfaceDTDHandler
Parameters:
name - The notation name.
publicId - The notation's public identifier, or null.
systemId - The notation's system identifier, or null.
Throws:
SAXException - The client may throw an exception during processing.
See Also:
DTDHandler.notationDecl(java.lang.String, java.lang.String, java.lang.String)

unparsedEntityDecl

public voidunparsedEntityDecl(java.lang.String name,                               java.lang.String publicId,                               java.lang.String systemId,                               java.lang.String notationName)                        throwsSAXException
Filter an unparsed entity declaration event.
Specified by:
unparsedEntityDecl in interfaceDTDHandler
Parameters:
name - The entity name.
publicId - The entity's public identifier, or null.
systemId - The entity's system identifier, or null.
notationName - The name of the associated notation.
Throws:
SAXException - The client may throw an exception during processing.
See Also:
DTDHandler.unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String)

setDocumentLocator

public voidsetDocumentLocator(Locator locator)
Filter a new document locator event.
Specified by:
setDocumentLocator in interfaceContentHandler
Parameters:
locator - The document locator.
See Also:
ContentHandler.setDocumentLocator(org.xml.sax.Locator)

startDocument

public voidstartDocument()                   throwsSAXException
Filter a start document event.
Specified by:
startDocument in interfaceContentHandler
Throws:
SAXException - The client may throw an exception during processing.
See Also:
ContentHandler.startDocument()

endDocument

public voidendDocument()                 throwsSAXException
Filter an end document event.
Specified by:
endDocument in interfaceContentHandler
Throws:
SAXException - The client may throw an exception during processing.
See Also:
ContentHandler.endDocument()

startPrefixMapping

public voidstartPrefixMapping(java.lang.String prefix,                               java.lang.String uri)                        throwsSAXException
Filter a start Namespace prefix mapping event.
Specified by:
startPrefixMapping in interfaceContentHandler
Parameters:
prefix - The Namespace prefix.
uri - The Namespace URI.
Throws:
SAXException - The client may throw an exception during processing.
See Also:
ContentHandler.startPrefixMapping(java.lang.String, java.lang.String)

endPrefixMapping

public voidendPrefixMapping(java.lang.String prefix)                      throwsSAXException
Filter an end Namespace prefix mapping event.
Specified by:
endPrefixMapping in interfaceContentHandler
Parameters:
prefix - The Namespace prefix.
Throws:
SAXException - The client may throw an exception during processing.
See Also:
ContentHandler.endPrefixMapping(java.lang.String)

startElement

public voidstartElement(java.lang.String uri,                         java.lang.String localName,                         java.lang.String qName,Attributes atts)                  throwsSAXException
Filter a start element event.
Specified by:
startElement in interfaceContentHandler
Parameters:
uri - The element's Namespace URI, or the empty string.
localName - The element's local name, or the empty string.
qName - The element's qualified (prefixed) name, or the empty string.
atts - The element's attributes.
Throws:
SAXException - The client may throw an exception during processing.
See Also:
ContentHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)

endElement

public voidendElement(java.lang.String uri,                       java.lang.String localName,                       java.lang.String qName)                throwsSAXException
Filter an end element event.
Specified by:
endElement in interfaceContentHandler
Parameters:
uri - The element's Namespace URI, or the empty string.
localName - The element's local name, or the empty string.
qName - The element's qualified (prefixed) name, or the empty string.
Throws:
SAXException - The client may throw an exception during processing.
See Also:
ContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String)

characters

public voidcharacters(char[] ch,                       int start,                       int length)                throwsSAXException
Filter a character data event.
Specified by:
characters in interfaceContentHandler
Parameters:
ch - An array of characters.
start - The starting position in the array.
length - The number of characters to use from the array.
Throws:
SAXException - The client may throw an exception during processing.
See Also:
ContentHandler.characters(char[], int, int)

ignorableWhitespace

public voidignorableWhitespace(char[] ch,                                int start,                                int length)                         throwsSAXException
Filter an ignorable whitespace event.
Specified by:
ignorableWhitespace in interfaceContentHandler
Parameters:
ch - An array of characters.
start - The starting position in the array.
length - The number of characters to use from the array.
Throws:
SAXException - The client may throw an exception during processing.
See Also:
ContentHandler.ignorableWhitespace(char[], int, int)

processingInstruction

public voidprocessingInstruction(java.lang.String target,                                  java.lang.String data)                           throwsSAXException
Filter a processing instruction event.
Specified by:
processingInstruction in interfaceContentHandler
Parameters:
target - The processing instruction target.
data - The text following the target.
Throws:
SAXException - The client may throw an exception during processing.
See Also:
ContentHandler.processingInstruction(java.lang.String, java.lang.String)

skippedEntity

public voidskippedEntity(java.lang.String name)                   throwsSAXException
Filter a skipped entity event.
Specified by:
skippedEntity in interfaceContentHandler
Parameters:
name - The name of the skipped entity.
Throws:
SAXException - The client may throw an exception during processing.
See Also:
ContentHandler.skippedEntity(java.lang.String)

warning

public voidwarning(SAXParseException e)             throwsSAXException
Filter a warning event.
Specified by:
warning in interfaceErrorHandler
Parameters:
e - The nwarning as an exception.
Throws:
SAXException - The client may throw an exception during processing.
See Also:
ErrorHandler.warning(org.xml.sax.SAXParseException)

error

public voiderror(SAXParseException e)           throwsSAXException
Filter an error event.
Specified by:
error in interfaceErrorHandler
Parameters:
e - The error as an exception.
Throws:
SAXException - The client may throw an exception during processing.
See Also:
ErrorHandler.error(org.xml.sax.SAXParseException)

fatalError

public voidfatalError(SAXParseException e)                throwsSAXException
Filter a fatal error event.
Specified by:
fatalError in interfaceErrorHandler
Parameters:
e - The error as an exception.
Throws:
SAXException - The client may throw an exception during processing.
See Also:
ErrorHandler.fatalError(org.xml.sax.SAXParseException)

         


[8]ページ先頭

©2009-2025 Movatter.jp