public class ParserFactory
extends Object
| java.lang.Object | |
| org.xml.sax.helpers.ParserFactory | |
此类已在API级别1中弃用。
该类可与已弃用的Parser界面一起使用。
用于动态加载SAX分析器的Java特定类。
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应用程序应该使用XMLReaderFactory 。
ParserFactory不是独立于平台的SAX定义的一部分; 它是专门为Java XML应用程序编写者设计的附加便利类。 SAX应用程序可以使用此类中的静态方法根据org.xml.sax.parser系统属性的值或包含类名称的字符串在运行时动态分配SAX分析器。
请注意,该应用程序仍然需要一个实现SAX1的XML解析器。
公共方法(Public methods) |
|
|---|---|
static Parser |
makeParser() 使用`org.xml.sax.parser'系统属性创建一个新的SAX解析器。 |
static Parser |
makeParser(String className) 使用提供的类名称创建一个新的SAX分析器对象。 |
继承方法(Inherited methods) |
|
|---|---|
java.lang.Object
|
|
Parser makeParser ()
使用`org.xml.sax.parser'系统属性创建一个新的SAX解析器。
指定的类必须存在并且必须实现 Parser接口。
| 返回(Returns) | |
|---|---|
Parser |
the newly created parser. |
| 抛出异常(Throws) | |
|---|---|
NullPointerException |
There is no value for the `org.xml.sax.parser' system property. |
ClassNotFoundException |
The SAX parser class was not found (check your CLASSPATH). |
IllegalAccessException |
The SAX parser class was found, but you do not have permission to load it. |
InstantiationException |
The SAX parser class was found but could not be instantiated. |
ClassCastException |
The SAX parser class was found and instantiated, but does not implement org.xml.sax.Parser. |
Parser makeParser (String className)
使用提供的类名称创建一个新的SAX分析器对象。
命名的类必须存在并且必须实现 Parser接口。
| 参数(Parameters) | |
|---|---|
className |
String: A string containing the name of the SAX parser class. |
| 返回(Returns) | |
|---|---|
Parser |
the newly created parser. |
| 抛出异常(Throws) | |
|---|---|
ClassNotFoundException |
The SAX parser class was not found (check your CLASSPATH). |
IllegalAccessException |
The SAX parser class was found, but you do not have permission to load it. |
InstantiationException |
The SAX parser class was found but could not be instantiated. |
ClassCastException |
The SAX parser class was found and instantiated, but does not implement org.xml.sax.Parser. |
也可以看看: