Most visited

Recently visited

Added in API level 1

XMLFilterImpl

public class XMLFilterImpl
extends Object implements XMLFilter, EntityResolver, DTDHandler, ContentHandler, ErrorHandler

java.lang.Object
   ↳ org.xml.sax.helpers.XMLFilterImpl


用于派生XML过滤器的基类。

This module, both source code and documentation, is in the Public Domain, and comes with NO WARRANTY. See http://www.saxproject.org for further information.

这个类被设计为位于XMLReader和客户端应用程序的事件处理程序之间。 默认情况下,它没有做任何事情,只是将请求传递给读写器并将事件传递给未经修改的处理程序,但子类可以覆盖特定的方法以在事件流或配置请求通过时修改它们。

也可以看看:

Summary

Public constructors

XMLFilterImpl()

构建一个空白的XML过滤器,没有父项。

XMLFilterImpl(XMLReader parent)

用指定的父级构建一个XML过滤器。

Public methods

void characters(char[] ch, int start, int length)

筛选字符数据事件。

void endDocument()

过滤结束文档事件。

void endElement(String uri, String localName, String qName)

过滤结束元素事件。

void endPrefixMapping(String prefix)

筛选结束命名空间前缀映射事件。

void error(SAXParseException e)

过滤错误事件。

void fatalError(SAXParseException e)

筛选致命的错误事件。

ContentHandler getContentHandler()

获取内容事件处理程序。

DTDHandler getDTDHandler()

获取当前的DTD事件处理程序。

EntityResolver getEntityResolver()

获取当前的实体解析器。

ErrorHandler getErrorHandler()

获取当前错误事件处理程序。

boolean getFeature(String name)

查找功能的值。

XMLReader getParent()

获得父母的读者。

Object getProperty(String name)

查找一个属性的值。

void ignorableWhitespace(char[] ch, int start, int length)

过滤可忽略的空白事件。

void notationDecl(String name, String publicId, String systemId)

过滤符号声明事件。

void parse(String systemId)

解析文档。

void parse(InputSource input)

解析文档。

void processingInstruction(String target, String data)

过滤处理指令事件。

InputSource resolveEntity(String publicId, String systemId)

过滤外部实体解析。

void setContentHandler(ContentHandler handler)

设置内容事件处理程序。

void setDTDHandler(DTDHandler handler)

设置DTD事件处理程序。

void setDocumentLocator(Locator locator)

筛选新的文档定位器事件。

void setEntityResolver(EntityResolver resolver)

设置实体解析器。

void setErrorHandler(ErrorHandler handler)

设置错误事件处理程序。

void setFeature(String name, boolean value)

设置功能的值。

void setParent(XMLReader parent)

设置父母阅读器。

void setProperty(String name, Object value)

设置属性的值。

void skippedEntity(String name)

过滤一个跳过的实体事件。

void startDocument()

筛选开始文档事件。

void startElement(String uri, String localName, String qName, Attributes atts)

筛选开始元素事件。

void startPrefixMapping(String prefix, String uri)

筛选开始名称空间前缀映射事件。

void unparsedEntityDecl(String name, String publicId, String systemId, String notationName)

过滤未解析的实体声明事件。

void warning(SAXParseException e)

过滤一个警告事件。

Inherited methods

From class java.lang.Object
From interface org.xml.sax.XMLFilter
From interface org.xml.sax.EntityResolver
From interface org.xml.sax.DTDHandler
From interface org.xml.sax.ContentHandler
From interface org.xml.sax.ErrorHandler
From interface org.xml.sax.XMLReader

Public constructors

XMLFilterImpl

Added in API level 1
XMLFilterImpl ()

构建一个空白的XML过滤器,没有父项。

此过滤器没有父项:除非您将此用作纯事件使用者而不是 XMLReader ,否则必须在开始分析之前分配父项或使用setFeature或setProperty进行任何配置。

也可以看看:

XMLFilterImpl

Added in API level 1
XMLFilterImpl (XMLReader parent)

用指定的父级构建一个XML过滤器。

Parameters
parent XMLReader: the XML reader from which this filter receives its events.

也可以看看:

Public methods

characters

Added in API level 1
void characters (char[] ch, 
                int start, 
                int length)

筛选字符数据事件。

Parameters
ch char: An array of characters.
start int: The starting position in the array.
length int: The number of characters to use from the array.
Throws
SAXException The client may throw an exception during processing.

endDocument

Added in API level 1
void endDocument ()

过滤结束文档事件。

Throws
SAXException The client may throw an exception during processing.

endElement

Added in API level 1
void endElement (String uri, 
                String localName, 
                String qName)

过滤结束元素事件。

Parameters
uri String: The element's Namespace URI, or the empty string.
localName String: The element's local name, or the empty string.
qName String: The element's qualified (prefixed) name, or the empty string.
Throws
SAXException The client may throw an exception during processing.

endPrefixMapping

Added in API level 1
void endPrefixMapping (String prefix)

筛选结束命名空间前缀映射事件。

Parameters
prefix String: The Namespace prefix.
Throws
SAXException The client may throw an exception during processing.

error

Added in API level 1
void error (SAXParseException e)

过滤错误事件。

Parameters
e SAXParseException: The error as an exception.
Throws
SAXException The client may throw an exception during processing.

fatalError

Added in API level 1
void fatalError (SAXParseException e)

筛选致命的错误事件。

Parameters
e SAXParseException: The error as an exception.
Throws
SAXException The client may throw an exception during processing.

getContentHandler

Added in API level 1
ContentHandler getContentHandler ()

获取内容事件处理程序。

Returns
ContentHandler The current content handler, or null if none was set.

getDTDHandler

Added in API level 1
DTDHandler getDTDHandler ()

获取当前的DTD事件处理程序。

Returns
DTDHandler The current DTD handler, or null if none was set.

getEntityResolver

Added in API level 1
EntityResolver getEntityResolver ()

获取当前的实体解析器。

Returns
EntityResolver The current entity resolver, or null if none was set.

getErrorHandler

Added in API level 1
ErrorHandler getErrorHandler ()

获取当前错误事件处理程序。

Returns
ErrorHandler The current error handler, or null if none was set.

getFeature

Added in API level 1
boolean getFeature (String name)

查找功能的值。

This will always fail if the parent is null.

Parameters
name String: The feature name.
Returns
boolean The current value of the feature.
Throws
SAXNotRecognizedException If the feature value can't be assigned or retrieved from the parent.
SAXNotSupportedException When the parent recognizes the feature name but cannot determine its value at this time.

getParent

Added in API level 1
XMLReader getParent ()

获得父母的读者。

Returns
XMLReader The parent XML reader, or null if none is set.

也可以看看:

getProperty

Added in API level 1
Object getProperty (String name)

查找一个属性的值。

Parameters
name String: The property name.
Returns
Object The current value of the property.
Throws
SAXNotRecognizedException If the property value can't be assigned or retrieved from the parent.
SAXNotSupportedException When the parent recognizes the property name but cannot determine its value at this time.

ignorableWhitespace

Added in API level 1
void ignorableWhitespace (char[] ch, 
                int start, 
                int length)

过滤可忽略的空白事件。

Parameters
ch char: An array of characters.
start int: The starting position in the array.
length int: The number of characters to use from the array.
Throws
SAXException The client may throw an exception during processing.

notationDecl

Added in API level 1
void notationDecl (String name, 
                String publicId, 
                String systemId)

过滤符号声明事件。

Parameters
name String: The notation name.
publicId String: The notation's public identifier, or null.
systemId String: The notation's system identifier, or null.
Throws
SAXException The client may throw an exception during processing.

parse

Added in API level 1
void parse (String systemId)

解析文档。

Parameters
systemId String: The system identifier as a fully-qualified URI.
Throws
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.

parse

Added in API level 1
void parse (InputSource input)

解析文档。

Parameters
input InputSource: The input source for the document entity.
Throws
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.

processingInstruction

Added in API level 1
void processingInstruction (String target, 
                String data)

过滤处理指令事件。

Parameters
target String: The processing instruction target.
data String: The text following the target.
Throws
SAXException The client may throw an exception during processing.

resolveEntity

Added in API level 1
InputSource resolveEntity (String publicId, 
                String systemId)

过滤外部实体解析。

Parameters
publicId String: The entity's public identifier, or null.
systemId String: The entity's system identifier.
Returns
InputSource A new InputSource or null for the default.
Throws
SAXException The client may throw an exception during processing.
IOException The client may throw an I/O-related exception while obtaining the new InputSource.

setContentHandler

Added in API level 1
void setContentHandler (ContentHandler handler)

设置内容事件处理程序。

Parameters
handler ContentHandler: the new content handler

setDTDHandler

Added in API level 1
void setDTDHandler (DTDHandler handler)

设置DTD事件处理程序。

Parameters
handler DTDHandler: the new DTD handler

setDocumentLocator

Added in API level 1
void setDocumentLocator (Locator locator)

筛选新的文档定位器事件。

Parameters
locator Locator: The document locator.

setEntityResolver

Added in API level 1
void setEntityResolver (EntityResolver resolver)

设置实体解析器。

Parameters
resolver EntityResolver: The new entity resolver.

setErrorHandler

Added in API level 1
void setErrorHandler (ErrorHandler handler)

设置错误事件处理程序。

Parameters
handler ErrorHandler: the new error handler

setFeature

Added in API level 1
void setFeature (String name, 
                boolean value)

设置功能的值。

如果父项为空,这将始终失败。

Parameters
name String: The feature name.
value boolean: The requested feature value.
Throws
SAXNotRecognizedException If the feature value can't be assigned or retrieved from the parent.
SAXNotSupportedException When the parent recognizes the feature name but cannot set the requested value.

setParent

Added in API level 1
void setParent (XMLReader parent)

设置父母阅读器。

这是XMLReader ,此过滤器将从中获取其事件并将其传递给其配置请求。 父母本身可能是另一个过滤器。

如果没有设置父阅读器,则任何解析或设置或获取功能或属性的尝试都将失败。

Parameters
parent XMLReader: The parent XML reader.

也可以看看:

setProperty

Added in API level 1
void setProperty (String name, 
                Object value)

设置属性的值。

如果父项为空,这将始终失败。

Parameters
name String: The property name.
value Object: The requested property value.
Throws
SAXNotRecognizedException If the property value can't be assigned or retrieved from the parent.
SAXNotSupportedException When the parent recognizes the property name but cannot set the requested value.

skippedEntity

Added in API level 1
void skippedEntity (String name)

过滤一个跳过的实体事件。

Parameters
name String: The name of the skipped entity.
Throws
SAXException The client may throw an exception during processing.

startDocument

Added in API level 1
void startDocument ()

筛选开始文档事件。

Throws
SAXException The client may throw an exception during processing.

startElement

Added in API level 1
void startElement (String uri, 
                String localName, 
                String qName, 
                Attributes atts)

筛选开始元素事件。

Parameters
uri String: The element's Namespace URI, or the empty string.
localName String: The element's local name, or the empty string.
qName String: The element's qualified (prefixed) name, or the empty string.
atts Attributes: The element's attributes.
Throws
SAXException The client may throw an exception during processing.

startPrefixMapping

Added in API level 1
void startPrefixMapping (String prefix, 
                String uri)

筛选开始名称空间前缀映射事件。

Parameters
prefix String: The Namespace prefix.
uri String: The Namespace URI.
Throws
SAXException The client may throw an exception during processing.

unparsedEntityDecl

Added in API level 1
void unparsedEntityDecl (String name, 
                String publicId, 
                String systemId, 
                String notationName)

过滤未解析的实体声明事件。

Parameters
name String: The entity name.
publicId String: The entity's public identifier, or null.
systemId String: The entity's system identifier, or null.
notationName String: The name of the associated notation.
Throws
SAXException The client may throw an exception during processing.

warning

Added in API level 1
void warning (SAXParseException e)

过滤一个警告事件。

Parameters
e SAXParseException: The warning as an exception.
Throws
SAXException The client may throw an exception during processing.

Hooray!