The XPathFactory class is
a factory for creating XPath expression
evaluators. Call the no-argument version of newInstance(
) to obtain an XPathFactory object that
creates XPath object to work with DOM documents.
The javax.xml.xpath package is nominally
object-model independent, however, and you can specify the name of a
different object model by calling the one-argument version of
newInstance( ).
Once you have created an XPathFactory object, you
can set default function and variable resolvers with
setXPathFunctionResolver(
) and setXPathVariableResolver(
). You can configure implementation-dependent features of
an XPathFactory with setFeature(
). All
implementations are required to support the
XMLConstants.FEATURE_SECURE_PROCESSING feature.
When this feature is set to true, external functions are not allowed
in XPath expressions, and the
XPathFunctionResolver is not used.
After creating and configuring an XPathFactory
object, use the newXPath( ) method to create one
or more XPath objects for actually evaluating
XPath expressions.
public abstract class XPathFactory {
// Protected Constructors
protected XPathFactory( );
// Public Constants
public static final String DEFAULT_OBJECT_MODEL_URI; ="http://java.sun.com/jaxp/xpath/dom"
public static final String DEFAULT_PROPERTY_NAME; ="javax.xml.xpath.XPathFactory"
// Public Class Methods
public static final XPathFactory newInstance( );
public static final XPathFactory newInstance(String uri)
throws XPathFactoryConfigurationException;
// Public Instance Methods
public abstract boolean getFeature(String name)
throws XPathFactoryConfigurationException;
public abstract boolean isObjectModelSupported(String objectModel);
public abstract XPath newXPath( );
public abstract void setFeature(String name, boolean value)
throws XPathFactoryConfigurationException;
public abstract void setXPathFunctionResolver(XPathFunctionResolver resolver);
public abstract void setXPathVariableResolver(XPathVariableResolver resolver);
}