Javax.xml.xpath.XPathFactory Class



Introduction

The javax.xml.xpath.XPathFactory class instance can be used to create XPath objects.Following are the important points about xpath.XPathFactory −

  • This class is not thread-safe.

  • This class is not re-entrant.

Class declaration

Following is the declaration for javax.xml.xpath.XPathFactory class:

public class XPathFactory
   extends Object

Field

Following are the fields for javax.xml.xpath.XPathFactory class −

  • static String DEFAULT_OBJECT_MODEL_URI − This is the default Object Model URI.

  • static String DEFAULT_PROPERTY_NAME − This is the default property name according to the JAXP spec.

Class constructors

S.N. Constructor & Description
1

protected XPathFactory()

This is the protected constructor as newInstance() or newInstance(String uri) or newInstance(String uri, String factoryClassName, ClassLoader classLoader) should be used to create a new instance of an XPathFactory.

Class methods

S.N. Method & Description
1

abstract boolean getFeature(String name)

This method gets the state of the named feature.

2

abstract boolean isObjectModelSupported(String objectModel)

This method shows that "Is specified object model supported by this XPathFactory?"

3

static XPathFactory newInstance()

This method gets a new XPathFactory instance using the default object model, DEFAULT_OBJECT_MODEL_URI, the W3C DOM.

4

static XPathFactory newInstance(String uri)

This method gets a new XPathFactory instance using the specified object model.

5

static XPathFactory newInstance(String uri, String factoryClassName, ClassLoader classLoader)

This method obtains a new instance of a XPathFactory from a factory class name.

6

abstract XPath newXPath()

This method returns a new XPath using the underlying object model determined when the XPathFactory was instantiated.

7

abstract void setFeature(String name, boolean value)

This method sets a feature for this XPathFactory and XPaths created by this factory.

8

abstract void setXPathFunctionResolver(XPathFunctionResolver resolver)

This method establish a default function resolver.

9

abstract void setXPathVariableResolver(XPathVariableResolver resolver)

This method establish a default variable resolver.

Methods inherited

This class inherits methods from the following classes −

java.lang.Object

Advertisements