public void setVariableContext(VariableContext variableContext) { xpath.setVariableContext(variableContext); }
public static List evaluate (Context context, Object arg) throws FunctionCallException { List contextNodes = context.getNodeSet(); if (contextNodes.size() == 0) return Collections.EMPTY_LIST; Navigator nav = context.getNavigator(); String xpathString; if ( arg instanceof String ) xpathString = (String)arg; else xpathString = StringFunction.evaluate(arg, nav); try { XPath xpath = nav.parseXPath(xpathString); ContextSupport support = context.getContextSupport(); xpath.setVariableContext( support.getVariableContext() ); xpath.setFunctionContext( support.getFunctionContext() ); xpath.setNamespaceContext( support.getNamespaceContext() ); return xpath.selectNodes( context.duplicate() ); } catch ( org.jaxen.saxpath.SAXPathException e ) { throw new FunctionCallException(e.toString()); } } }
/** * @param expression The XPath expression * @param filter The coercion filter * @param variables The XPath variable context * @param namespaces The XPath namespace context */ public JaxenCompiled(String expression, Filter<T> filter, Map<String, Object> variables, Namespace[] namespaces) { super(expression, filter, variables, namespaces); try { xPath = new BaseXPath(expression, navigator); } catch (JaxenException e) { throw new IllegalArgumentException("Unable to compile '" + expression + "'. See Cause.", e); } xPath.setNamespaceContext(this); xPath.setVariableContext(this); }
public void setVariableContext(VariableContext variableContext) { xpath.setVariableContext(variableContext); }
public void setVariableContext(VariableContext variableContext) { xpath.setVariableContext(variableContext); }
public void setVariableContext(VariableContext variableContext) { xpath.setVariableContext(variableContext); }
public void setVariableContext(VariableContext variableContext) { xpath.setVariableContext(variableContext); }
public void setVariableContext(VariableContext variableContext) { xpath.setVariableContext(variableContext); }
public void setVariableContext(VariableContext variableContext) { xpath.setVariableContext(variableContext); }
public void setVariableContext(VariableContext variableContext) { xpath.setVariableContext(variableContext); }
public void setVariableContext(VariableContext variableContext) { xpath.setVariableContext(variableContext); }
public Object evaluate(JellyContext context) { this.context = context; try { XPath xpath = new Dom4jXPath( this.xpathExpr.evaluateAsString( context ) ); xpath.setVariableContext(this); if (log.isDebugEnabled()) { log.debug( "Setting the namespace context to be: " + uris ); } xpath.setNamespaceContext( new SimpleNamespaceContext( this.uris ) ); return xpath; } catch (JaxenException e) { log.error( "Error constructing xpath", e ); } return null; }
public Object evaluate(JellyContext context) { this.context = context; try { XPath xpath = new Dom4jXPath( this.xpathExpr.evaluateAsString( context ) ); xpath.setVariableContext(this); if (log.isDebugEnabled()) { log.debug( "Setting the namespace context to be: " + uris ); } xpath.setNamespaceContext( new SimpleNamespaceContext( this.uris ) ); return xpath; } catch (JaxenException e) { log.error( "Error constructing xpath", e ); } return null; }
public Object evaluate(JellyContext context) { this.context = context; try { XPath xpath = new Dom4jXPath( this.xpathExpr.evaluateAsString( context ) ); xpath.setVariableContext(this); if (log.isDebugEnabled()) { log.debug( "Setting the namespace context to be: " + uris ); } xpath.setNamespaceContext( new SimpleNamespaceContext( this.uris ) ); return xpath; } catch (JaxenException e) { log.error( "Error constructing xpath", e ); } return null; }
public static XPath getXPath(String path, Map<String, String> namespaces, Map<QName, Function> functions, Map<QName, Object> variables) throws JaxenException { DocumentNavigator nav = new DocumentNavigator(); XPath contextpath = new BaseXPath(path, nav); if (namespaces != null) { for (Map.Entry<String, String> entry : namespaces.entrySet()) { contextpath.addNamespace(entry.getKey(), entry.getValue()); } } if (functions != null) { contextpath.setFunctionContext(getFunctionContext(functions, (SimpleFunctionContext)contextpath .getFunctionContext())); } if (variables != null) contextpath.setVariableContext(getVariableContext(variables, (SimpleVariableContext)contextpath .getVariableContext())); return contextpath; }
xpath.setVariableContext(new VariableContext() {