|
JavaTM 2 Platform Std. Ed. v1.4.2 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.xml.sax.helpers.XMLFilterImpl
Base class for deriving an XML filter.
This module, both source code and documentation, is in the Public Domain, and comes with NO WARRANTY.
This class is designed to sit between an XMLReader
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.
XMLFilter
,
XMLReader
,
EntityResolver
,
DTDHandler
,
ContentHandler
,
ErrorHandler
Constructor Summary | |
XMLFilterImpl()
Construct an empty XML filter, with no parent. |
|
XMLFilterImpl(XMLReader parent)
Construct an XML filter with the specified parent. |
Method Summary | |
void |
characters(char[] ch,
int start,
int length)
Filter a character data event. |
void |
endDocument()
Filter an end document event. |
void |
endElement(String uri,
String localName,
String qName)
Filter an end element event. |
void |
endPrefixMapping(String prefix)
Filter an end Namespace prefix mapping event. |
void |
error(SAXParseException e)
Filter an error event. |
void |
fatalError(SAXParseException e)
Filter a fatal error event. |
ContentHandler |
getContentHandler()
Get the content event handler. |
DTDHandler |
getDTDHandler()
Get the current DTD event handler. |
EntityResolver |
getEntityResolver()
Get the current entity resolver. |
ErrorHandler |
getErrorHandler()
Get the current error event handler. |
boolean |
getFeature(String name)
Look up the state of a feature. |
XMLReader |
getParent()
Get the parent reader. |
Object |
getProperty(String name)
Look up the value of a property. |
void |
ignorableWhitespace(char[] ch,
int start,
int length)
Filter an ignorable whitespace event. |
void |
notationDecl(String name,
String publicId,
String systemId)
Filter a notation declaration event. |
void |
parse(InputSource input)
Parse a document. |
void |
parse(String systemId)
Parse a document. |
void |
processingInstruction(String target,
String data)
Filter a processing instruction event. |
InputSource |
resolveEntity(String publicId,
String systemId)
Filter an external entity resolution. |
void |
setContentHandler(ContentHandler handler)
Set the content event handler. |
void |
setDocumentLocator(Locator locator)
Filter a new document locator event. |
void |
setDTDHandler(DTDHandler handler)
Set the DTD event handler. |
void |
setEntityResolver(EntityResolver resolver)
Set the entity resolver. |
void |
setErrorHandler(ErrorHandler handler)
Set the error event handler. |
void |
setFeature(String name,
boolean state)
Set the state of a feature. |
void |
setParent(XMLReader parent)
Set the parent reader. |
void |
setProperty(String name,
Object value)
Set the value of a property. |
void |
skippedEntity(String name)
Filter a skipped entity event. |
void |
startDocument()
Filter a start document event. |
void |
startElement(String uri,
String localName,
String qName,
Attributes atts)
Filter a start element event. |
void |
startPrefixMapping(String prefix,
String uri)
Filter a start Namespace prefix mapping event. |
void |
unparsedEntityDecl(String name,
String publicId,
String systemId,
String notationName)
Filter an unparsed entity declaration event. |
void |
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 |
Constructor Detail |
public XMLFilterImpl()
This filter will have no parent: you must assign a parent before you start a parse or do any configuration with setFeature or setProperty.
XMLReader.setFeature(java.lang.String, boolean)
,
XMLReader.setProperty(java.lang.String, java.lang.Object)
public XMLFilterImpl(XMLReader parent)
setParent(org.xml.sax.XMLReader)
,
getParent()
Method Detail |
public void setParent(XMLReader parent)
This is the XMLReader
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.
parent
- The parent XML reader.
NullPointerException
- If the parent is null.getParent()
public XMLReader getParent()
setParent(org.xml.sax.XMLReader)
public void setFeature(String name, boolean state) throws SAXNotRecognizedException, SAXNotSupportedException
This will always fail if the parent is null.
setFeature
in interface XMLReader
name
- The feature name.state
- The requested feature state.
SAXNotRecognizedException
- When the
XMLReader does not recognize the feature name.
SAXNotSupportedException
- When the
XMLReader recognizes the feature name but
cannot set the requested value.XMLReader.setFeature(java.lang.String, boolean)
public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException
This will always fail if the parent is null.
getFeature
in interface XMLReader
name
- The feature name.
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.XMLReader.getFeature(java.lang.String)
public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException
This will always fail if the parent is null.
setProperty
in interface XMLReader
name
- The property name.
SAXNotRecognizedException
- When the
XMLReader does not recognize the property name.
SAXNotSupportedException
- When the
XMLReader recognizes the property name but
cannot set the requested value.XMLReader.setProperty(java.lang.String, java.lang.Object)
public Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException
getProperty
in interface XMLReader
name
- The property name.
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.XMLReader.setFeature(java.lang.String, boolean)
public void setEntityResolver(EntityResolver resolver)
setEntityResolver
in interface XMLReader
resolver
- The new entity resolver.
NullPointerException
- If the resolver
is null.XMLReader.setEntityResolver(org.xml.sax.EntityResolver)
public EntityResolver getEntityResolver()
getEntityResolver
in interface XMLReader
XMLReader.getEntityResolver()
public void setDTDHandler(DTDHandler handler)
setDTDHandler
in interface XMLReader
handler
- The DTD handler.
NullPointerException
- If the handler
is null.XMLReader.setDTDHandler(org.xml.sax.DTDHandler)
public DTDHandler getDTDHandler()
getDTDHandler
in interface XMLReader
XMLReader.getDTDHandler()
public void setContentHandler(ContentHandler handler)
setContentHandler
in interface XMLReader
handler
- The content handler.
NullPointerException
- If the handler
is null.XMLReader.setContentHandler(org.xml.sax.ContentHandler)
public ContentHandler getContentHandler()
getContentHandler
in interface XMLReader
XMLReader.getContentHandler()
public void setErrorHandler(ErrorHandler handler)
setErrorHandler
in interface XMLReader
handler
- The error handler.
NullPointerException
- If the handler
is null.XMLReader.setErrorHandler(org.xml.sax.ErrorHandler)
public ErrorHandler getErrorHandler()
getErrorHandler
in interface XMLReader
XMLReader.getErrorHandler()
public void parse(InputSource input) throws SAXException, IOException
input
- The input source for the document entity.
SAXException
- Any SAX exception, possibly
wrapping another exception.
IOException
- An IO exception from the parser,
possibly from a byte stream or character stream
supplied by the application.XMLReader.parse(org.xml.sax.InputSource)
public void parse(String systemId) throws SAXException, IOException
systemId
- The system identifier as a fully-qualified URI.
SAXException
- Any SAX exception, possibly
wrapping another exception.
IOException
- An IO exception from the parser,
possibly from a byte stream or character stream
supplied by the application.XMLReader.parse(java.lang.String)
public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException
resolveEntity
in interface EntityResolver
publicId
- The entity's public identifier, or null.systemId
- The entity's system identifier.
SAXException
- The client may throw
an exception during processing.
IOException
- The client may throw an
I/O-related exception while obtaining the
new InputSource.EntityResolver.resolveEntity(java.lang.String, java.lang.String)
public void notationDecl(String name, String publicId, String systemId) throws SAXException
notationDecl
in interface DTDHandler
name
- The notation name.publicId
- The notation's public identifier, or null.systemId
- The notation's system identifier, or null.
SAXException
- The client may throw
an exception during processing.DTDHandler.notationDecl(java.lang.String, java.lang.String, java.lang.String)
public void unparsedEntityDecl(String name, String publicId, String systemId, String notationName) throws SAXException
unparsedEntityDecl
in interface DTDHandler
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.
SAXException
- The client may throw
an exception during processing.DTDHandler.unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
public void setDocumentLocator(Locator locator)
setDocumentLocator
in interface ContentHandler
locator
- The document locator.ContentHandler.setDocumentLocator(org.xml.sax.Locator)
public void startDocument() throws SAXException
startDocument
in interface ContentHandler
SAXException
- The client may throw
an exception during processing.ContentHandler.startDocument()
public void endDocument() throws SAXException
endDocument
in interface ContentHandler
SAXException
- The client may throw
an exception during processing.ContentHandler.endDocument()
public void startPrefixMapping(String prefix, String uri) throws SAXException
startPrefixMapping
in interface ContentHandler
prefix
- The Namespace prefix.uri
- The Namespace URI.
SAXException
- The client may throw
an exception during processing.ContentHandler.startPrefixMapping(java.lang.String, java.lang.String)
public void endPrefixMapping(String prefix) throws SAXException
endPrefixMapping
in interface ContentHandler
prefix
- The Namespace prefix.
SAXException
- The client may throw
an exception during processing.ContentHandler.endPrefixMapping(java.lang.String)
public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException
startElement
in interface ContentHandler
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.
SAXException
- The client may throw
an exception during processing.ContentHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
public void endElement(String uri, String localName, String qName) throws SAXException
endElement
in interface ContentHandler
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.
SAXException
- The client may throw
an exception during processing.ContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String)
public void characters(char[] ch, int start, int length) throws SAXException
characters
in interface ContentHandler
ch
- An array of characters.start
- The starting position in the array.length
- The number of characters to use from the array.
SAXException
- The client may throw
an exception during processing.ContentHandler.characters(char[], int, int)
public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException
ignorableWhitespace
in interface ContentHandler
ch
- An array of characters.start
- The starting position in the array.length
- The number of characters to use from the array.
SAXException
- The client may throw
an exception during processing.ContentHandler.ignorableWhitespace(char[], int, int)
public void processingInstruction(String target, String data) throws SAXException
processingInstruction
in interface ContentHandler
target
- The processing instruction target.data
- The text following the target.
SAXException
- The client may throw
an exception during processing.ContentHandler.processingInstruction(java.lang.String, java.lang.String)
public void skippedEntity(String name) throws SAXException
skippedEntity
in interface ContentHandler
name
- The name of the skipped entity.
SAXException
- The client may throw
an exception during processing.ContentHandler.skippedEntity(java.lang.String)
public void warning(SAXParseException e) throws SAXException
warning
in interface ErrorHandler
e
- The nwarning as an exception.
SAXException
- The client may throw
an exception during processing.ErrorHandler.warning(org.xml.sax.SAXParseException)
public void error(SAXParseException e) throws SAXException
error
in interface ErrorHandler
e
- The error as an exception.
SAXException
- The client may throw
an exception during processing.ErrorHandler.error(org.xml.sax.SAXParseException)
public void fatalError(SAXParseException e) throws SAXException
fatalError
in interface ErrorHandler
e
- The error as an exception.
SAXException
- The client may throw
an exception during processing.ErrorHandler.fatalError(org.xml.sax.SAXParseException)
|
JavaTM 2 Platform Std. Ed. v1.4.2 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 2003 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.