Ejemplo n.º 1
0
 public void setExpressionValue(String xpath, String expression) {
   // #debug
   System.out.println("setExpressionValue xpath=" + xpath + ", expression=" + expression);
   XFormsModel model = getModel();
   InstanceItem item = model.getInstanceItem(xpath, getContext(), this);
   if (item == null) {
     // #debug warning
     System.out.println("Could not set " + xpath + " to " + expression + ", no such data element");
     return;
   }
   Node context = item.getNode();
   XPathExpression expr = model.createExpression(expression, this);
   String value = expr.evaluate(context, XPathResult.STRING).asString();
   // #debug
   System.out.println("Setting value to " + value);
   item.setStringValue(value);
 }
Ejemplo n.º 2
0
 public XPathResult getValue(String xpath) {
   XFormsModel model = getModel();
   XPathExpression expr = model.createExpression(xpath, this);
   return expr.evaluate(getContext(), XPathResult.ANY);
 }