-
Notifications
You must be signed in to change notification settings - Fork 1
XPath Java Interop
The purpose of this guide is to walk through how the XPath Java API is (and is not) used.
All classes in this guide refer to the JDK's javax.xml.xpath
package unless otherwise noted. Also, all functions refer to the xenopath.xpath
namespace unless otherwise noted.
The function compile-expr
will return its argument if it is an instance of XPathExpression
. If it isn't, it will call this method with the argument in an attempt to compile it. When compiling an expression, it is an error if the argument is null or not a String
.
XPathExpression compile(String expression)
These two methods are never called, preferring their three argument siblings with XPathConstants/STRING
.
String evaluate(String expression, InputSource source)
String evaluate(String expression, Object item)
The first method below is called whenever the source
argument to any of the lookup
functions is an instance of org.xml.sax.InputSource
. Otherwise the second method is called. The returnType
argument is never provided directly by the user. The javax.xml.namespace.QName
instance is ultimately provided by each lookup-*
function and obtained from XPathConstants
.
Object evaluate(String expression, InputSource source, QName returnType)
Object evaluate(String expression, Object item, QName returnType)
These methods are not being used. Open an issue to request their use.
NamespaceContext getNamespaceContext()
void setNamespaceContext(NamespaceContext nsContext)
These methods are not being used. Open an issue to request their use.
XPathFunctionResolver getXPathFunctionResolver()
void setXPathFunctionResolver(XPathFunctionResolver resolver)
XPathVariableResolver getXPathVariableResolver()
void setXPathVariableResolver(XPathVariableResolver resolver)
This method is not being used. Open an issue to request its use.
void reset()
These methods are never called, preferring their two argument siblings with XPathConstants/STRING
.
String evaluate(InputSource source)
String evaluate(Object item)
The first method below is called whenever the source
argument to any of the lookup
functions is an instance of org.xml.sax.InputSource
. Otherwise the second method is called. The returnType
argument is never provided directly by the user. The javax.xml.namespace.QName
instance is ultimately provided by each lookup-*
function and obtained from XPathConstants
.
Object evaluate(InputSource source, QName returnType)
Object evaluate(Object item, QName returnType)
This interface is not being used. Open an issue to request its use.
Object evaluate(List args)
This interface is not being used. Open an issue to request its use.
XPathFunction resolveFunction(QName functionName, int arity)
This interface is not being used. Open an issue to request its use.
XPathFunction resolveVariable(QName variableName)
The following javax.xml.namespace.QName
instances are used to determine the return type when evaluating an expression.
static QName BOOLEAN
static QName NODE
static QName NODESET
static QName NUMBER
static QName STRING
This object is not being used. Open an issue to request its use.
String DOM_OBJECT_MODEL
The following two objects are not being used directly. Open an issue to request their use.
static String DEFAULT_OBJECT_MODEL_URI
static String DEFAULT_PROPERTY_NAME
This is the only method used to instantiate an XPathFactory
instance.
static XPathFactory newInstance()
These two methods are not being used directly. Open an issue to request their use.
static XPathFactory newInstance(String uri)
static XPathFactory newInstance(String uri, String factoryClassName, ClassLoader classLoader)
This method is used to initialize an XPath object for evaluating expressions.
XPath newXPath()
These two methods are not being used. Open an issue to request their use.
boolean getFeature(String name)
void setFeature(String name, boolean value)
This method is not being used. Open an issue to request its use.
boolean isObjectModelSupported(String objectModel)
These methods are not being used. Open an issue to request their use.
void setXPathFunctionResolver(XPathFunctionResolver resolver)
void setXPathVariableResolver(XPathVariableResolver resolver)
This exception is not dealt with by the library.
This exception is not dealt with by the library.
This exception is not dealt with by the library.
This exception is not dealt with by the library.