public class ParserAdapter
extends Object implements XMLReader, DocumentHandler
| java.lang.Object | |
| org.xml.sax.helpers.ParserAdapter | |
将SAX1解析器作为SAX2 XMLReader进行调整。
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.
此类包装SAX1 Parser并使其充当SAX2 XMLReader ,具有功能,属性和名称空间支持。 请注意,由于SAX1不提供该信息,因此无法报告skippedEntity事件。
此适配器不会测试重复名称空间限定的属性名称。
也可以看看:
Public constructors |
|
|---|---|
ParserAdapter() 构建一个新的解析器适配器。 |
|
ParserAdapter(Parser parser) 构建一个新的解析器适配器。 |
|
公共方法(Public methods) |
|
|---|---|
void |
characters(char[] ch, int start, int length) 适配器实现方法; 不要打电话。 |
void |
endDocument() 适配器实现方法; 不要打电话。 |
void |
endElement(String qName) 适配器实现方法; 不要打电话。 |
ContentHandler |
getContentHandler() 返回当前的内容处理程序。 |
DTDHandler |
getDTDHandler() 返回当前的DTD处理程序。 |
EntityResolver |
getEntityResolver() 返回当前的实体解析器。 |
ErrorHandler |
getErrorHandler() 返回当前的错误处理程序。 |
boolean |
getFeature(String name) 检查解析器功能标志。 |
Object |
getProperty(String name) 获取解析器属性。 |
void |
ignorableWhitespace(char[] ch, int start, int length) 适配器实现方法; 不要打电话。 |
void |
parse(InputSource input) 解析一个XML文档。 |
void |
parse(String systemId) 解析一个XML文档。 |
void |
processingInstruction(String target, String data) 适配器实现方法; 不要打电话。 |
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 |
setProperty(String name, Object value) 设置解析器属性。 |
void |
startDocument() 适配器实现方法; 不要打电话。 |
void |
startElement(String qName, AttributeList qAtts) 适配器实现方法; 不要打电话。 |
继承方法(Inherited methods) |
|
|---|---|
java.lang.Object
|
|
org.xml.sax.XMLReader
|
|
org.xml.sax.DocumentHandler
|
|
ParserAdapter ()
构建一个新的解析器适配器。
使用“org.xml.sax.parser”属性来查找嵌入式SAX1驱动程序。
| 抛出异常(Throws) | |
|---|---|
SAXException |
If the embedded driver cannot be instantiated or if the org.xml.sax.parser property is not specified. |
ParserAdapter (Parser parser)
构建一个新的解析器适配器。
请注意,一旦创建了适配器,嵌入式解析器就无法更改; 嵌入一个不同的解析器,分配一个新的ParserAdapter。
| 参数(Parameters) | |
|---|---|
parser |
Parser: The SAX1 parser to embed. |
| 抛出异常(Throws) | |
|---|---|
NullPointerException |
If the parser parameter is null. |
void characters (char[] ch,
int start,
int length)
适配器实现方法; 不要打电话。 调整SAX1人物事件。
| 参数(Parameters) | |
|---|---|
ch |
char: An array of characters. |
start |
int: The starting position in the array. |
length |
int: The number of characters to use. |
| 抛出异常(Throws) | |
|---|---|
SAXException |
The client may raise a processing exception. |
也可以看看:
void endDocument ()
适配器实现方法; 不要打电话。 修改SAX1结束文档事件。
| 抛出异常(Throws) | |
|---|---|
SAXException |
The client may raise a processing exception. |
也可以看看:
void endElement (String qName)
适配器实现方法; 不要打电话。 调整SAX1结束元素事件。
| 参数(Parameters) | |
|---|---|
qName |
String: The qualified (prefixed) name. |
| 抛出异常(Throws) | |
|---|---|
SAXException |
The client may raise a processing exception. |
也可以看看:
ContentHandler getContentHandler ()
返回当前的内容处理程序。
| 返回(Returns) | |
|---|---|
ContentHandler |
The current content handler, or null if none was supplied. |
也可以看看:
DTDHandler getDTDHandler ()
返回当前的DTD处理程序。
| 返回(Returns) | |
|---|---|
DTDHandler |
the current DTD handler, or null if none was supplied |
也可以看看:
EntityResolver getEntityResolver ()
返回当前的实体解析器。
| 返回(Returns) | |
|---|---|
EntityResolver |
The current entity resolver, or null if none was supplied. |
也可以看看:
ErrorHandler getErrorHandler ()
返回当前的错误处理程序。
| 返回(Returns) | |
|---|---|
ErrorHandler |
The current error handler, or null if none was supplied. |
也可以看看:
boolean getFeature (String name)
检查解析器功能标志。
唯一识别的功能是命名空间和命名空间前缀。
| 参数(Parameters) | |
|---|---|
name |
String: The feature name, as a complete URI. |
| 返回(Returns) | |
|---|---|
boolean |
The current feature value. |
| 抛出异常(Throws) | |
|---|---|
SAXNotRecognizedException |
If the feature value can't be assigned or retrieved. |
SAXNotSupportedException |
If the feature is not currently readable. |
也可以看看:
Object getProperty (String name)
获取解析器属性。
目前没有属性被识别。
| 参数(Parameters) | |
|---|---|
name |
String: The property name. |
| 返回(Returns) | |
|---|---|
Object |
The property value. |
| 抛出异常(Throws) | |
|---|---|
SAXNotRecognizedException |
If the property value can't be assigned or retrieved. |
SAXNotSupportedException |
If the property value is not currently readable. |
也可以看看:
void ignorableWhitespace (char[] ch,
int start,
int length)
适配器实现方法; 不要打电话。 修改SAX1可忽略的空白事件。
| 参数(Parameters) | |
|---|---|
ch |
char: An array of characters. |
start |
int: The starting position in the array. |
length |
int: The number of characters to use. |
| 抛出异常(Throws) | |
|---|---|
SAXException |
The client may raise a processing exception. |
void parse (InputSource input)
解析一个XML文档。
| 参数(Parameters) | |
|---|---|
input |
InputSource: An input source for the document. |
| 抛出异常(Throws) | |
|---|---|
IOException |
If there is a problem reading the raw content of the document. |
SAXException |
If there is a problem processing the document. |
void parse (String systemId)
解析一个XML文档。
| 参数(Parameters) | |
|---|---|
systemId |
String: The absolute URL of the document. |
| 抛出异常(Throws) | |
|---|---|
IOException |
If there is a problem reading the raw content of the document. |
SAXException |
If there is a problem processing the document. |
void processingInstruction (String target, String data)
适配器实现方法; 不要打电话。 调整SAX1处理指令事件。
| 参数(Parameters) | |
|---|---|
target |
String: The processing instruction target. |
data |
String: The remainder of the processing instruction |
| 抛出异常(Throws) | |
|---|---|
SAXException |
The client may raise a processing exception. |
void setContentHandler (ContentHandler handler)
设置内容处理程序。
| 参数(Parameters) | |
|---|---|
handler |
ContentHandler: the new content handler |
void setDTDHandler (DTDHandler handler)
设置DTD处理程序。
| 参数(Parameters) | |
|---|---|
handler |
DTDHandler: the new DTD handler |
void setDocumentLocator (Locator locator)
适配器实现方法; 不要打电话。 修改SAX1文档定位器事件。
| 参数(Parameters) | |
|---|---|
locator |
Locator: A document locator. |
也可以看看:
void setEntityResolver (EntityResolver resolver)
设置实体解析器。
| 参数(Parameters) | |
|---|---|
resolver |
EntityResolver: The new entity resolver. |
void setErrorHandler (ErrorHandler handler)
设置错误处理程序。
| 参数(Parameters) | |
|---|---|
handler |
ErrorHandler: The new error handler. |
void setFeature (String name, boolean value)
为分析器设置一个功能标志。
唯一识别的功能是命名空间和命名空间前缀。
| 参数(Parameters) | |
|---|---|
name |
String: The feature name, as a complete URI. |
value |
boolean: The requested feature value. |
| 抛出异常(Throws) | |
|---|---|
SAXNotRecognizedException |
If the feature can't be assigned or retrieved. |
SAXNotSupportedException |
If the feature can't be assigned that value. |
也可以看看:
void setProperty (String name, Object value)
设置解析器属性。
目前没有属性被识别。
| 参数(Parameters) | |
|---|---|
name |
String: The property name. |
value |
Object: The property value. |
| 抛出异常(Throws) | |
|---|---|
SAXNotRecognizedException |
If the property value can't be assigned or retrieved. |
SAXNotSupportedException |
If the property can't be assigned that value. |
也可以看看:
void startDocument ()
适配器实现方法; 不要打电话。 调整SAX1启动文档事件。
| 抛出异常(Throws) | |
|---|---|
SAXException |
The client may raise a processing exception. |
也可以看看:
void startElement (String qName, AttributeList qAtts)
适配器实现方法; 不要打电话。 调整SAX1 startElement事件。
如有必要,请执行命名空间处理。
| 参数(Parameters) | |
|---|---|
qName |
String: The qualified (prefixed) name. |
qAtts |
AttributeList: The XML attribute list (with qnames). |
| 抛出异常(Throws) | |
|---|---|
SAXException |
The client may raise a processing exception. |