public class XMLFilterImpl extends Object implements XMLFilter, EntityResolver, DTDHandler, ContentHandler, ErrorHandler
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和客户端应用程序的事件处理程序之间。默认情况下,它只会传递请求到阅读器和事件上的处理程序未修改,但子类可以重写特定的方法来修改事件流或配置请求,因为它们通过。
XMLFilter,
XMLReader,
EntityResolver,
DTDHandler,
ContentHandler,
ErrorHandler
| Constructor and Description |
|---|
XMLFilterImpl()
构建一个空的XML筛选器,没有父类。
|
XMLFilterImpl(XMLReader parent)
用指定的父项构造一个XML筛选器。
|
| Modifier and Type | Method and Description |
|---|---|
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()
获取当前文档的事件处理程序。
|
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(InputSource input)
解析文档。
|
void |
parse(String systemId)
解析文档。
|
void |
processingInstruction(String target, String data)
筛选处理指令事件。
|
InputSource |
resolveEntity(String publicId, String systemId)
过滤外部实体分辨率。
|
void |
setContentHandler(ContentHandler handler)
设置内容事件处理程序。
|
void |
setDocumentLocator(Locator locator)
过滤一个新的文档定位事件。
|
void |
setDTDHandler(DTDHandler handler)
设置DTD事件处理程序。
|
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)
筛选警告事件。
|
public XMLFilterImpl()
此过滤器将没有家长:你必须指定一个家长在你开始解析或setfeature或设置做任何配置,除非你使用这个作为一个纯粹的事件消费者而不是作为一个XMLReader。
public XMLFilterImpl(XMLReader parent)
public void setParent(XMLReader parent)
这是XMLReader此过滤器将获得它的事件,它会通过它的配置要求。父可能本身是另一个过滤器。
如果没有父阅读器设置,任何试图解析或设置或得到一个功能或属性将失败。
setParent 接口
XMLFilter
parent -母XML读取器。
getParent()
public XMLReader getParent()
getParent 接口
XMLFilter
setParent(org.xml.sax.XMLReader)
public void setFeature(String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException
如果父是空的,则会失败。
setFeature 接口
XMLReader
name -功能名称。
value -。
SAXNotRecognizedException -如果特征值不能被分配或从母体取出。
SAXNotSupportedException -当家长识别特征的名字但不能设置请求的值。
XMLReader.getFeature(java.lang.String)
public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException
如果父是空的,则会失败。
getFeature 接口
XMLReader
name -功能名称。
SAXNotRecognizedException -如果特征值不能被分配或从母体取出。
SAXNotSupportedException -当家长识别特征的名字但不能确定它的价值在这个时候。
XMLReader.setFeature(java.lang.String, boolean)
public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException
如果父是空的,则会失败。
setProperty 接口
XMLReader
name -属性名称。
value -要求的属性值。
SAXNotRecognizedException -如果属性值不能被分配或从母体取出。
SAXNotSupportedException -当家长认识到属性名称,但不能设置请求的值。
public Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException
getProperty 接口
XMLReader
name -属性名称。
SAXNotRecognizedException -如果属性值不能被分配或从母体取出。
SAXNotSupportedException -当家长认识到属性名称,但不能确定它的价值在这个时候。
XMLReader.setProperty(java.lang.String, java.lang.Object)
public void setEntityResolver(EntityResolver resolver)
setEntityResolver 接口
XMLReader
resolver -新实体解析器。
XMLReader.getEntityResolver()
public EntityResolver getEntityResolver()
getEntityResolver 接口
XMLReader
XMLReader.setEntityResolver(org.xml.sax.EntityResolver)
public void setDTDHandler(DTDHandler handler)
setDTDHandler 接口
XMLReader
handler -新的DTD处理程序
XMLReader.getDTDHandler()
public DTDHandler getDTDHandler()
getDTDHandler 接口
XMLReader
XMLReader.setDTDHandler(org.xml.sax.DTDHandler)
public void setContentHandler(ContentHandler handler)
setContentHandler 接口
XMLReader
handler -新的内容处理程序
XMLReader.getContentHandler()
public ContentHandler getContentHandler()
getContentHandler 接口
XMLReader
XMLReader.setContentHandler(org.xml.sax.ContentHandler)
public void setErrorHandler(ErrorHandler handler)
setErrorHandler 接口
XMLReader
handler -新的错误处理程序
XMLReader.getErrorHandler()
public ErrorHandler getErrorHandler()
getErrorHandler 接口
XMLReader
XMLReader.setErrorHandler(org.xml.sax.ErrorHandler)
public void parse(InputSource input) throws SAXException, IOException
parse 接口
XMLReader
input -文档实体的输入源。
SAXException -萨克斯例外,可能是包装的另一个例外。
IOException -从解析器的IO异常,可能从一个字节流和字符流的应用程序提供的。
InputSource,
XMLReader.parse(java.lang.String),
XMLReader.setEntityResolver(org.xml.sax.EntityResolver),
XMLReader.setDTDHandler(org.xml.sax.DTDHandler),
XMLReader.setContentHandler(org.xml.sax.ContentHandler),
XMLReader.setErrorHandler(org.xml.sax.ErrorHandler)
public void parse(String systemId) throws SAXException, IOException
parse 接口
XMLReader
systemId -作为一个完全合格的URI标识系统。
SAXException -萨克斯例外,可能是包装的另一个例外。
IOException -从解析器的IO异常,可能从一个字节流和字符流的应用程序提供的。
XMLReader.parse(org.xml.sax.InputSource)
public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException
resolveEntity 接口
EntityResolver
publicId -实体的公共标识符,或空。
systemId -实体的系统标识符。
SAXException -客户端可能会抛出一个异常处理过程中。
IOException -客户可以抛出一个I/O相关的例外而获得新的inputsource。
InputSource
public void notationDecl(String name, String publicId, String systemId) throws SAXException
notationDecl 接口
DTDHandler
name -符号名称。
publicId -符号的公共标识符,或空。
systemId -符号的系统标识符,或空。
SAXException -客户端可能会抛出一个异常处理过程中。
DTDHandler.unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String),
Attributes
public void unparsedEntityDecl(String name, String publicId, String systemId, String notationName) throws SAXException
unparsedEntityDecl 接口
DTDHandler
name -实体名称。
publicId -实体的公共标识符,或空。
systemId -实体的系统标识符,或空。
notationName -相关的符号名称。
SAXException -客户端可能会抛出一个异常处理过程中。
DTDHandler.notationDecl(java.lang.String, java.lang.String, java.lang.String),
Attributes
public void setDocumentLocator(Locator locator)
setDocumentLocator 接口
ContentHandler
locator -文件定位器。
Locator
public void startDocument()
throws SAXException
startDocument 接口
ContentHandler
SAXException -客户端可能会抛出一个异常处理过程中。
ContentHandler.endDocument()
public void endDocument()
throws SAXException
endDocument 接口
ContentHandler
SAXException -客户端可能会抛出一个异常处理过程中。
ContentHandler.startDocument()
public void startPrefixMapping(String prefix, String uri) throws SAXException
startPrefixMapping 接口
ContentHandler
prefix -命名空间前缀。
uri的命名空间URI。
SAXException -客户端可能会抛出一个异常处理过程中。
ContentHandler.endPrefixMapping(java.lang.String),
ContentHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
public void endPrefixMapping(String prefix) throws SAXException
endPrefixMapping 接口
ContentHandler
prefix -命名空间前缀。
SAXException -客户端可能会抛出一个异常处理过程中。
ContentHandler.startPrefixMapping(java.lang.String, java.lang.String),
ContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String)
public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException
startElement 接口
ContentHandler
uri -元素的命名空间URI或空字符串。
localName -元素的本地名称,或空字符串。
qName -元素的合格(前缀)的名字,或空字符串。
atts -元素的属性。
SAXException -客户端可能会抛出一个异常处理过程中。
ContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String),
Attributes,
AttributesImpl
public void endElement(String uri, String localName, String qName) throws SAXException
endElement 接口
ContentHandler
uri -元素的命名空间URI或空字符串。
localName -元素的本地名称,或空字符串。
qName -元素的合格(前缀)的名字,或空字符串。
SAXException -客户端可能会抛出一个异常处理过程中。
public void characters(char[] ch,
int start,
int length)
throws SAXException
characters 接口
ContentHandler
ch -一个字符数组。
start -数组中的起始位置。
length -字符数使用数组。
SAXException -客户端可能会抛出一个异常处理过程中。
ContentHandler.ignorableWhitespace(char[], int, int),
Locator
public void ignorableWhitespace(char[] ch,
int start,
int length)
throws SAXException
ignorableWhitespace 接口
ContentHandler
ch -一个字符数组。
start -数组中的起始位置。
length -字符数使用数组。
SAXException -客户端可能会抛出一个异常处理过程中。
ContentHandler.characters(char[], int, int)
public void processingInstruction(String target, String data) throws SAXException
processingInstruction 接口
ContentHandler
target -处理指令的目标。
data跟踪目标文本。
SAXException -客户端可能会抛出一个异常处理过程中。
public void skippedEntity(String name) throws SAXException
skippedEntity 接口
ContentHandler
name -跳过的实体的名称。
SAXException -客户端可能会抛出一个异常处理过程中。
public void warning(SAXParseException e) throws SAXException
warning 接口
ErrorHandler
e -警告作为例外。
SAXException -客户端可能会抛出一个异常处理过程中。
SAXParseException
public void error(SAXParseException e) throws SAXException
error 接口
ErrorHandler
e -误差作为例外。
SAXException -客户端可能会抛出一个异常处理过程中。
SAXParseException
public void fatalError(SAXParseException e) throws SAXException
fatalError 接口
ErrorHandler
e -误差作为例外。
SAXException -客户端可能会抛出一个异常处理过程中。
SAXParseException
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.