1

Java VTD-XML has the following API

class AutoPilot{
    declareVariableExpr(java.lang.String varName, java.lang.String varExpr);
}
Register the binding between a variableExpr name and variableExpr expression

I have successfully used it for simple variable bindings like:

abc => "some value" 

and Autopilot can run expressions like

ap.selectXpath("concat(/a/b/text(),  $abc)");
ap.evalXPathToString()

My question is:

The API says it binds a variable to a variable expression. how to bind to a variable expression? and what is the usage of binding to an 'expression'?

weima
  • 4,653
  • 6
  • 34
  • 55

1 Answers1

0

Try this. ap.declareVariableExpr("my_expr","/a/b/c");

vtd-xml-author
  • 3,319
  • 4
  • 22
  • 30
  • thanks. but what is the use of binding the variable to an expression. that is my real question. variable can be bound to a value. you mean "/a/b/c" is a value? – weima Oct 15 '12 at 06:57
  • Yep, it will be evaluated to a value, eg. String boolean or a double depending on the context – vtd-xml-author Oct 15 '12 at 07:43