-
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.
XPathExpression compile(String expression)
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.
String evaluate(String expression, InputSource source)
This method is never called, preferring its three argument sibling with XPathConstants/STRING.
Object evaluate(String expression, InputSource source, QName returnType)
This method is called whenever the source argument to any of the lookup functions is an instance of org.xml.sax.InputSource.
The returnType is never provided directly by the user. It is either provided by calling the corresponding lookup-* function for each javax.xml.namespace.QName in XPathConstants, or by passing in the corresponding keyword to lookup.
String evaluate(String expression, Object item)
This method is never called, preferring its three argument sibling with XPathConstants/STRING.
Object evaluate(String expression, Object item, QName returnType)
This is the same as 3 except that it is only called when the source argument is anything but org.xml.sax.InputSource.
NamespaceContext getNamespaceContext()
This is currently not being used. Open an issue to request this feature.
XPathFunctionResolver getXPathFunctionResolver()
This is currently not being used. Open an issue to request this feature.
XPathVariableResolver getXPathVariableResolver()
This is currently not being used. Open an issue to request this feature.
void reset()
This is currently not being used. Open an issue to request this feature.
void setNamespaceContext(NamespaceContext nsContext)
This is currently not being used. Open an issue to request this feature.
void getXPathFunctionResolver(XPathFunctionResolver resolver)
This is currently not being used. Open an issue to request this feature.
void getXPathVariableResolver(XPathVariableResolver resolver)
This is currently not being used. Open an issue to request this feature.