-
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)String evaluate(String expression, Object item)
The two methods above are never called, preferring their three argument siblings with XPathConstants/STRING.
Object evaluate(String expression, InputSource source, QName returnType)Object evaluate(String expression, Object item, QName returnType)
The first method above 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.
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()
String evaluate(InputSource source)String evaluate(Object item)
The two methods above are never called, preferring their two argument siblings with XPathConstants/STRING.
Object evaluate(InputSource source, QName returnType)Object evaluate(Object item, QName returnType)
The first method above 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.