newby here so sorry if this is an obvious mistake. I need to declare a variable that my query uses. I have the following code:
final Configuration config;
DynamicQueryContext dynamicContext ;
//some instantiation here
new DOMSource(dom)) );
String query="for $a in $root//price return $a";
Variable thisVar = Variable.make("root");
XQueryExpression exp = staticContext.compileQuery(query);
At which point I get a runtime exception that variable $root is not declared (I know the query is unnecessarily complex but for purposes of my app I prefer not to alter the query). The binding I'm trying to achieve is equivalent to let $root:=doc(...).
Also, through some debugging, I know the binding makes into the variables map of the static context object...not sure why it's not found when compile is called.
Thanks for any help
Your query needs to declare the variable $root as an external variable:
declare variable $root external;
(Sorry for the delayed response, SourceForce hasn't been notifying me of these postings)
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.