Package org.apache.axiom.om.xpath

Examples of org.apache.axiom.om.xpath.AXIOMXPath.selectSingleNode()


               /* for (String prefix : namespacePrefixes.keySet()) {
                    xpath.addNamespace(prefix, namespacePrefixes.get(prefix));
                }*/
            }
            // we always expect to return an omElement from the xpath expression
            OMElement omElementToUse = (OMElement) xpath.selectSingleNode(eventOMElement);
            Class beanClass = Class.forName(type);
            return BeanUtil.deserialize(beanClass,
                    omElementToUse, new ReflectionBasedObjectSupplier(), null);
        } catch (ClassNotFoundException e) {
            throw new CEPEventProcessingException("Can not load the class " + type, e);
View Full Code Here


  }

  public static String getFirstValue(OMElement el, String path, String ns)
      throws Exception {
    AXIOMXPath xpathe = formatXPath(path, ns);
    return ((OMElement) xpathe.selectSingleNode(el)).getText();
  }
 
  public static boolean evalExpression(OMElement el, String path, String ns)
      throws Exception {
    AXIOMXPath xpathe = formatXPath(path, ns);
View Full Code Here

     */
    public OMElement parse(String operationName) throws FileNotFoundException,
                                                        XMLStreamException, JaxenException {
        AXIOMXPath xPath = new AXIOMXPath("//service/operation[@name='"
                                          + operationName + "']");
        return (OMElement) xPath.selectSingleNode(parseConfig());
    }

    /**
     * read UI configuration file from a predefined path
     *
 
View Full Code Here

    AXIOMXPath xPath = new AXIOMXPath("//m:Balance");
    xPath.addNamespace("m", "urn:ebay:api:PayPalAPI");
    // xPath.add("m", "http://www.w3.org/2001/XMLSchema-instance");
    // xPath.addNamespace("xsi",
    // "http://www.w3.org/2001/XMLSchema-instance");
    OMElement last = (OMElement) xPath.selectSingleNode(result);
    if (last != null) {
      // return String.format("%s %s", last.getText(), last.getAttribute(
      // new QName("currencyID")).getAttributeValue());
      return String.format("%s %s", last.getText(), "");
    } else {
View Full Code Here

      XMLStreamException, JaxenException {
    String filePath = "sample.xml";
    OMElement rootElem = new StAXOMBuilder(filePath).getDocumentElement();
    AXIOMXPath xPath = new AXIOMXPath("//service/operation[@name='"
        + operationName + "']");
    return (OMElement) xPath.selectSingleNode(rootElem);
  }
}
View Full Code Here

                                + " | s12:Header/ns:" + EventingConstants.TOPIC_HEADER_NAME);
                topicXPath.addNamespace("s11", "http://schemas.xmlsoap.org/soap/envelope/");
                topicXPath.addNamespace("s12", "http://www.w3.org/2003/05/soap-envelope");
                topicXPath.addNamespace("ns", EventingConstants.TOPIC_HEADER_NS);

                OMElement topicNode = (OMElement) topicXPath.selectSingleNode(mc.getEnvelope());
                if (topicNode != null) {
                    topic = topicNode.getText();
                }
            } catch (JaxenException e) {
                throw new WSEventException("can not process the xpath ", e);
View Full Code Here

        try {
            OMElement element = AXIOMUtil.stringToOM(getXmlOfMediatorScenarioOneA("full"));

            AXIOMXPath xPath = new AXIOMXPath("//property/@name");
            //xPath.addNamespace(SynapseConstants.SYNAPSE_NAMESPACE, "");
            Object o = xPath.selectSingleNode(element);
            if (o instanceof OMAttribute) {
                System.out.println(((OMAttribute) o).getAttributeValue());
            }
        } catch (XMLStreamException e) {
            e.printStackTrace();
View Full Code Here

                XMLStreamReader streamReader =
                        XMLInputFactory.newInstance().createXMLStreamReader(buildInputStream);
                StAXOMBuilder builder = new StAXOMBuilder(streamReader);
                XPath xp = new AXIOMXPath("/project/property[@name='name']");
                OMElement documentElement = builder.getDocumentElement();
                OMElement nameEle = (OMElement) xp.selectSingleNode(documentElement);
                if (nameEle != null) {
                    OMAttribute omAttribute = nameEle.getAttribute(new QName("value"));
                    String nameVal = omAttribute.getAttributeValue();
                    if (nameVal != null) {
                        name = nameVal;
View Full Code Here

        assertNotNull(response);

        AXIOMXPath xPath = new AXIOMXPath("//return");
        xPath.addNamespace("ns","http://services.samples/xsd");
        OMElement returnEle = (OMElement) xPath.selectSingleNode(response);

        assertNotNull(returnEle);

        assertEquals(returnEle.getText().trim(),"100");
View Full Code Here

     */
    public static String parseStandardQuoteResponse(OMElement result) throws Exception {

        AXIOMXPath xPath = new AXIOMXPath("//ns:last");
        xPath.addNamespace("ns","http://services.samples/xsd");
        OMElement last = (OMElement) xPath.selectSingleNode(result);
        if (last != null) {
            return last.getText();
        } else {
            throw new Exception("Unexpected response : " + result);
        }
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.