Namespaces and variables both need to be declared (on the
XPathCompiler) before the XPath expression is compiled. You can reuse the
XPathCompiler to compile many XPath expressions, and its state (including
declared variables and namespaces) is retained between
Value for variables need to be set up on the XPathSelector
before the expression is evaluated. You can reuse the XPathSelector (and it
retains the variable values) provided that you don't try to use it concurrently
in different threads.
Hope this answers the question!
I am trying
to improve performance of my app by using the saxon API on JDOM documents
rather than JAXEN.
process I have a number of questions?
1) Do I
need to explicitly set up namespace context?
2) If I do
when should I do it? Can it be done before the load of the compiled
3) When do
I set up variables? Can I do this before the load()?
for wanting to do this before the load is that I want to reduce the amount of
setup for each new XPATH as I have literally hundreds to process against the
same document with the same namespace and variable