Package org.apache.synapse.processors.rules

Examples of org.apache.synapse.processors.rules.XPathProcessor


public class XpathProcessorTest extends TestCase {
    public void testXpathProcessor() throws Exception {
        SynapseMessage sm = new Axis2SynapseMessage(
                Axis2EnvSetup.axis2Deployment("target/synapse-repository"));
        XPathProcessor pro = new XPathProcessor();
        pro.setXPathExpr("//ns:text");
        pro.addXPathNamespace("ns", "urn:text-body");
        boolean result = pro.process(null, sm);
        assertTrue(result);

    }
View Full Code Here


        boolean result = pro.process(null, sm);
        assertTrue(result);

        List list = new LinkedList();
        list.add(new RegexProcessor());
        list.add(new XPathProcessor());
        pro.setList(list);

        boolean ret = pro.process(null,sm);

        assertTrue(ret);
View Full Code Here

   *
   * @see org.apache.synapse.spi.Processor#compile(org.apache.synapse.api.SynapseEnvironment,
   *      org.apache.axis2.om.OMElement)
   */
  public Processor createProcessor(SynapseEnvironment se, OMElement el) {
    XPathProcessor xp = new XPathProcessor();

    super.addChildrenAndSetName(se, el, xp);

    OMAttribute expr = el.getAttribute(XPATH_EXPRESSION_ATT_Q);
    if (expr == null) {
      throw new SynapseException(XPATH + " must have "
          + XPATH_EXPRESSION_ATT_Q + " attribute: " + el.toString());
    }

    xp.setXPathExpr(expr.getAttributeValue());
    Iterator it = el.getAllDeclaredNamespaces();
    while (it.hasNext()) {
      OMNamespace n = (OMNamespace) it.next();
      xp.addXPathNamespace(n.getPrefix(), n.getName());
    }

    return xp;
  }
View Full Code Here

TOP

Related Classes of org.apache.synapse.processors.rules.XPathProcessor

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.