public void setStringValue(String xpath, String value) { XFormsModel model = getModel(); InstanceItem item = model.getInstanceItem(xpath, getContext(), this); if (item == null) { return; } item.setStringValue(value); }
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); }