Condividi tramite


XPathFactory.NewInstance Method

Definition

Overloads

NewInstance()

Get a new XPathFactory instance using the default object model, #DEFAULT_OBJECT_MODEL_URI, the W3C DOM.

NewInstance(String)

Get a new XPathFactory instance using the specified object model.

NewInstance(String, String, ClassLoader)

Get a new <code>XPathFactory</code> instance using the default object model, #DEFAULT_OBJECT_MODEL_URI, the W3C DOM.

NewInstance()

Get a new XPathFactory instance using the default object model, #DEFAULT_OBJECT_MODEL_URI, the W3C DOM.

[Android.Runtime.Register("newInstance", "()Ljavax/xml/xpath/XPathFactory;", "")]
public static Javax.Xml.Xpath.XPathFactory? NewInstance ();
[<Android.Runtime.Register("newInstance", "()Ljavax/xml/xpath/XPathFactory;", "")>]
static member NewInstance : unit -> Javax.Xml.Xpath.XPathFactory

Returns

Instance of an XPathFactory.

Attributes

Remarks

Get a new XPathFactory instance using the default object model, #DEFAULT_OBJECT_MODEL_URI, the W3C DOM.

This method is functionally equivalent to:

newInstance(DEFAULT_OBJECT_MODEL_URI)

Since the implementation for the W3C DOM is always available, this method will never fail.

Java documentation for javax.xml.xpath.XPathFactory.newInstance().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

NewInstance(String)

Get a new XPathFactory instance using the specified object model.

[Android.Runtime.Register("newInstance", "(Ljava/lang/String;)Ljavax/xml/xpath/XPathFactory;", "")]
public static Javax.Xml.Xpath.XPathFactory? NewInstance (string? uri);
[<Android.Runtime.Register("newInstance", "(Ljava/lang/String;)Ljavax/xml/xpath/XPathFactory;", "")>]
static member NewInstance : string -> Javax.Xml.Xpath.XPathFactory

Parameters

uri
String

Identifies the underlying object model. The specification only defines the URI #DEFAULT_OBJECT_MODEL_URI, http://java.sun.com/jaxp/xpath/dom for the W3C DOM, the org.w3c.dom package, and implementations are free to introduce other URIs for other object models.

Returns

Instance of an XPathFactory.

Attributes

Exceptions

If the specified object model is unavailable.

If uri is null.

If uri.length() == 0.

Remarks

Get a new XPathFactory instance using the specified object model.

To find a XPathFactory object, this method looks the following places in the following order where "the class loader" refers to the context class loader:

<ol> <li> If the system property #DEFAULT_PROPERTY_NAME + ":uri" is present, where uri is the parameter to this method, then its value is read as a class name. The method will try to create a new instance of this class by using the class loader, and returns it if it is successfully created. </li> <li> ${java.home}/lib/jaxp.properties is read and the value associated with the key being the system property above is looked for. If present, the value is processed just like above. </li> <li> The class loader is asked for service provider provider-configuration files matching javax.xml.xpath.XPathFactory in the resource directory META-INF/services. See the JAR File Specification for file format and parsing rules. Each potential service provider is required to implement the method:

{@link #isObjectModelSupported(String objectModel)}

The first service provider found in class loader order that supports the specified object model is returned. </li> <li> Platform default XPathFactory is located in a platform specific way. There must be a platform default XPathFactory for the W3C DOM, i.e. #DEFAULT_OBJECT_MODEL_URI. </li> </ol>

If everything fails, an XPathFactoryConfigurationException will be thrown.

Tip for Trouble-shooting:

See java.util.Properties#load(java.io.InputStream) for exactly how a property file is parsed. In particular, colons ':' need to be escaped in a property file, so make sure the URIs are properly escaped in it. For example:

http\://java.sun.com/jaxp/xpath/dom=org.acme.DomXPathFactory

Java documentation for javax.xml.xpath.XPathFactory.newInstance(java.lang.String).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

NewInstance(String, String, ClassLoader)

Get a new <code>XPathFactory</code> instance using the default object model, #DEFAULT_OBJECT_MODEL_URI, the W3C DOM.

[Android.Runtime.Register("newInstance", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/ClassLoader;)Ljavax/xml/xpath/XPathFactory;", "")]
public static Javax.Xml.Xpath.XPathFactory? NewInstance (string? uri, string? factoryClassName, Java.Lang.ClassLoader? classLoader);
[<Android.Runtime.Register("newInstance", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/ClassLoader;)Ljavax/xml/xpath/XPathFactory;", "")>]
static member NewInstance : string * string * Java.Lang.ClassLoader -> Javax.Xml.Xpath.XPathFactory

Parameters

uri
String
factoryClassName
String
classLoader
ClassLoader

Returns

Instance of an XPathFactory.

Attributes

Exceptions

If the specified object model is unavailable.

If uri is null.

If uri.length() == 0.

Remarks

Java documentation for javax.xml.xpath.XPathFactory.newInstance(java.lang.String, java.lang.String, java.lang.ClassLoader).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to