Examples of XPathProcessor


Examples of org.apache.excalibur.xml.xpath.XPathProcessor

            if (!"".equals(select)) {

               
                DOMParser parser = null;
                XPathProcessor processor = null;
               
                try {
                    parser = (DOMParser)this.manager.lookup(DOMParser.ROLE);
                    processor = (XPathProcessor)this.manager.lookup(XPathProcessor.ROLE);

                    InputSource input = SourceUtil.getInputSource(source);

                    Document document = parser.parseDocument(input);
                    NodeList list = processor.selectNodeList(document, select);
                    int length = list.getLength();
                    for (int i=0; i<length; i++) {
                          IncludeXMLConsumer.includeNode((Node)list.item(i),
                                               (ContentHandler)this, 
                                               (LexicalHandler)this);
View Full Code Here

Examples of org.apache.excalibur.xml.xpath.XPathProcessor

                    Document document = SourceUtil.toDOM(source);
                    Element element = document.getDocumentElement();

                    String xpath = DomHelper.getAttribute(bindingElm, "xpath", null);
                    if (xpath != null) {
                        XPathProcessor xpathProcessor = (XPathProcessor)manager.lookup(XPathProcessor.ROLE);
                        try {
                            Node node = xpathProcessor.selectSingleNode(document, xpath);
                            if (node == null)
                                throw new BindingException("XPath expression \"" + xpath + "\" didn't return a result.");
                            if (!(node instanceof Element))
                                throw new BindingException("XPath expression \"" + xpath + "\" did not return an element node.");
                            element = (Element)node;
View Full Code Here

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

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

        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

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

   *
   * @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
Copyright © 2018 www.massapi.com. 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.