testBean = new TestBean();
context = JXPathContext.newContext(testBean);
Variables vars = context.getVariables();
vars.declareVariable("test", new TestFunctions(4, "test"));
FunctionLibrary lib = new FunctionLibrary();
lib.addFunctions(new ClassFunctions(TestFunctions.class, "test"));
lib.addFunctions(new ClassFunctions(TestFunctions2.class, "test"));
lib.addFunctions(new PackageFunctions("", "call"));
lib.addFunctions(
new PackageFunctions(
"org.apache.commons.jxpath.ri.compiler.",
"jxpathtest"));
lib.addFunctions(new PackageFunctions("", null));
context.setFunctions(lib);
context.getVariables().declareVariable("List.class", List.class);
context.getVariables().declareVariable("NodeSet.class", NodeSet.class);
}
functions = new ClassFunctions(TestFunctions.class, "test");