java命名空间javax.xml.xpath类xpathfactory成员方法:
newinstance定义参考
本文导语:
newinstance
public static xpathfactory newinstance(string uri,
string factoryclassname,
classloader classloader)
throws xpathfactoryconfigurationexception
根据工厂类名称获取...
newinstance
public static xpathfactory newinstance(string uri,
string factoryclassname,
classloader classloader)
throws xpathfactoryconfigurationexception
根据工厂类名称获取一个新 xpathfactory 实例。如果指定的工厂类支持指定的对象模型,则返回 xpathfactory。当类路径中有多个提供者时此函数很有用。它给了应用程序更多的控制权,因为它能指定应该加载哪个提供者。
设置 jaxp.debug 系统属性将导致此方法将许多调试消息打印到 system.err,以说明正在执行的操作以及在何处查找。
如有问题,请尝试:
java -djaxp.debug=1 yourprogram ....
- 参数:
uri - 标识底层对象模型。规范只定义了 uri default_object_model_uri、用于 w3c dom 的 http://java.sun.com/jaxp/xpath/dom、org.w3c.dom 包。至于其他对象模型,实现可随意引入其他 uri。factoryclassname - 完全限定工厂类名称,提供 javax.xml.xpath.xpathfactory 的实现。classloader - 用来加载工厂类的 classloader。如果为 null,则使用当前 thread 的上下文 classloader 来加载工厂类。
- 返回:
- 新的
xpathfactory 实例
- 抛出:
xpathfactoryconfigurationexception - 如果 factoryclassname 为 null、工厂类不能被加载或实例化、工厂类不支持 uri 参数中指定的对象模型。
nullpointerexception - 如果 uri 为 null。
illegalargumentexception - 如果 uri 为 null 或 uri.length() == 0。- 从以下版本开始:
- 1.6
- 另请参见:
newinstance(),
newinstance(string uri)