Package org.jaxen

Examples of org.jaxen.SimpleVariableContext


        assertEquals(6, new SynapseXPath("string-length(//test)").numberValueOf(ctx).intValue());
    }
   
    public void testCustomVariables() throws Exception {
        SynapseXPath xpath = new SynapseXPath("$myvar");
        SimpleVariableContext variableContext = new SimpleVariableContext();
        variableContext.setVariableValue("myvar", "myvalue");
        xpath.setVariableContext(variableContext);
        assertEquals("myvalue", xpath.evaluate(TestUtils.getTestContext("<test/>")));
    }
View Full Code Here


  }
 
  private static VariableContext getVariableContext(
    Map<QName,Object> variables,
    SimpleVariableContext context) {
    if (context == null) context = new SimpleVariableContext();
    for (QName qname : variables.keySet()) {
      Object value = variables.get(qname);
      context.setVariableValue(
        qname.getNamespaceURI(),
        qname.getLocalPart(),
View Full Code Here

        assertEquals(6, new SynapseXPath("string-length(//test)").numberValueOf(ctx).intValue());
    }
   
    public void testCustomVariables() throws Exception {
        SynapseXPath xpath = new SynapseXPath("$myvar");
        SimpleVariableContext variableContext = new SimpleVariableContext();
        variableContext.setVariableValue("myvar", "myvalue");
        xpath.setVariableContext(variableContext);
        assertEquals("myvalue", xpath.evaluate(TestUtils.getTestContext("<test/>")));
    }
View Full Code Here

    {
        if (this.contextSupport == null)
        {
            this.contextSupport = new ContextSupport(new SimpleNamespaceContext(),
                    XPathFunctionContext.getInstance(),
                    new SimpleVariableContext(),
                    getNavigator());
        }
        return this.contextSupport;
    }
View Full Code Here

        log("Document [" + url + "]");
        Object document = nav.getDocument(url);
        XPath contextpath = new BaseXPath("/", nav);
        log("Initial Context :: " + contextpath);
        List list = contextpath.selectNodes(document);
        SimpleVariableContext varContext = new SimpleVariableContext();
        varContext.setVariableValue(null, "foobar", "foobar");
        varContext.setVariableValue(null, "foo", "foo");
        getContextSupport().setVariableContext(varContext);
        Iterator iter = list.iterator();
        while (iter.hasNext())
        {
            Object context = iter.next();
View Full Code Here

    public ContextSupport getContextSupport() {
        if (this.contextSupport == null) {
            this.contextSupport = new ContextSupport(new SimpleNamespaceContext(),
                                                     XPathFunctionContext.getInstance(),
                                                     new SimpleVariableContext(),
                                                     getNavigator());
        }
        return this.contextSupport;
    }
View Full Code Here

        log("Document [" + url + "]");
        Object document = nav.getDocument(url);
        XPath contextpath = new BaseXPath("/", nav);
        log("Initial Context :: " + contextpath);
        List list = contextpath.selectNodes(document);
        SimpleVariableContext varContext = new SimpleVariableContext();
        varContext.setVariableValue(null, "foobar", "foobar");
        varContext.setVariableValue(null, "foo", "foo");
        getContextSupport().setVariableContext(varContext);
        Iterator iter = list.iterator();
        while (iter.hasNext()) {
            Object context = iter.next();
            assertValueOfXPath("foobar", context, "$foobar");
View Full Code Here

  }
 
  private static VariableContext getVariableContext(
    Map<QName,Object> variables,
    SimpleVariableContext context) {
    if (context == null) context = new SimpleVariableContext();
    for (QName qname : variables.keySet()) {
      Object value = variables.get(qname);
      context.setVariableValue(
        qname.getNamespaceURI(),
        qname.getLocalPart(),
View Full Code Here

    {
        if (this.contextSupport == null)
        {
            this.contextSupport = new ContextSupport(new SimpleNamespaceContext(),
                    XPathFunctionContext.getInstance(),
                    new SimpleVariableContext(),
                    getNavigator());
        }
        return this.contextSupport;
    }
View Full Code Here

        log("Document [" + url + "]");
        Object document = nav.getDocument(url);
        XPath contextpath = new BaseXPath("/", nav);
        log("Initial Context :: " + contextpath);
        List list = contextpath.selectNodes(document);
        SimpleVariableContext varContext = new SimpleVariableContext();
        varContext.setVariableValue(null, "foobar", "foobar");
        varContext.setVariableValue(null, "foo", "foo");
        getContextSupport().setVariableContext(varContext);
        Iterator iter = list.iterator();
        while (iter.hasNext())
        {
            Object context = iter.next();
View Full Code Here

TOP

Related Classes of org.jaxen.SimpleVariableContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.