/** Retrieve the <code>VariableContext</code> used by this XPath * expression. * * <p> * A <code>VariableContext</code> is responsible for resolving * all variables referenced within the expression. * </p> * * <p> * If this XPath expression has not previously had a <code>VariableContext</code> * installed, a new default <code>VariableContext</code> will be created, * installed and returned. * </p> * * @return the <code>VariableContext</code> used by this expression * * @see VariableContext */ public VariableContext getVariableContext() { return getContextSupport().getVariableContext(); }
/** Retrieve a variable value. * * @param namespaceURI the function namespace URI * @param prefix the function prefix * @param localName the function name * * @return the variable value. * * @throws UnresolvableException if unable to locate a bound variable. */ public Object getVariableValue( String namespaceURI, String prefix, String localName ) throws UnresolvableException { VariableContext context = getVariableContext(); if ( context != null ) { return context.getVariableValue( namespaceURI, prefix, localName ); } else { throw new UnresolvableException( "No variable context installed" ); } }
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()); } } }
new ContextSupport(baseContextSupport.getNamespaceContext(), new SynapseXPathFunctionContext(baseContextSupport.getFunctionContext(), synCtx), new SynapseXPathVariableContext(baseContextSupport.getVariableContext(), synCtx), baseContextSupport.getNavigator()); Context context = new Context(contextSupport); new ContextSupport(baseContextSupport.getNamespaceContext(), baseContextSupport.getFunctionContext(), new SynapseXPathVariableContext(baseContextSupport.getVariableContext(), env), baseContextSupport.getNavigator()); Context context = new Context(contextSupport); new ContextSupport(baseContextSupport.getNamespaceContext(), baseContextSupport.getFunctionContext(), new SynapseXPathVariableContext(baseContextSupport.getVariableContext(), wrapper.getMessageCtxt(), wrapper.getEnvelope()), baseContextSupport.getNavigator());
new ContextSupport(baseContextSupport.getNamespaceContext(), new SynapseXPathFunctionContext(baseContextSupport.getFunctionContext(), synCtx), new SynapseXPathVariableContext(baseContextSupport.getVariableContext(), synCtx), baseContextSupport.getNavigator()); Context context = new Context(contextSupport); new ContextSupport(baseContextSupport.getNamespaceContext(), baseContextSupport.getFunctionContext(), new SynapseXPathVariableContext(baseContextSupport.getVariableContext(), env), baseContextSupport.getNavigator()); Context context = new Context(contextSupport); new ContextSupport(baseContextSupport.getNamespaceContext(), baseContextSupport.getFunctionContext(), new SynapseXPathVariableContext(baseContextSupport.getVariableContext(), wrapper.getMessageCtxt(), wrapper.getEnvelope()), baseContextSupport.getNavigator());