Package org.springframework.xml.xpath

Examples of org.springframework.xml.xpath.XPathExpression


    Traffic traffic = new Traffic();
    try {   
      Document document =
        DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(inputMessage.getBody());

      XPathExpression titlesXp = XPathExpressionFactory.createXPathExpression("/ResultSet/Result[@type='incident']/Title");
      List<Node> titles = titlesXp.evaluateAsNodeList(document);
      XPathExpression descXp = XPathExpressionFactory.createXPathExpression("/ResultSet/Result[@type='incident']/Description");
      List<Node> description = descXp.evaluateAsNodeList(document);
      int counter = 0;
      for (Node node : titles) {
        traffic.addIncident(((Element)node).getTextContent(), ((Element)description.get(counter++)).getTextContent());
      }
    } catch (Exception e) {
View Full Code Here


    protected void assertXpathEvaluatesTo(String message,
                                          String expectedValue,
                                          String xpathExpression,
                                          SOAPMessage soapMessage) {
        XPathExpression expression = XPathExpressionFactory.createXPathExpression(xpathExpression, namespaces);
        Document document = soapMessage.getSOAPPart();
        String actualValue = expression.evaluateAsString(document);
        Assert.assertEquals(message, expectedValue, actualValue);
    }
View Full Code Here

        String actualValue = expression.evaluateAsString(document);
        Assert.assertEquals(message, expectedValue, actualValue);
    }

    protected void assertXpathExists(String message, String xpathExpression, SOAPMessage soapMessage) {
        XPathExpression expression = XPathExpressionFactory.createXPathExpression(xpathExpression, namespaces);
        Document document = soapMessage.getSOAPPart();
        Node node = expression.evaluateAsNode(document);
        Assert.assertNotNull(message, node);
    }
View Full Code Here

        Node node = expression.evaluateAsNode(document);
        Assert.assertNotNull(message, node);
    }

    protected void assertXpathNotExists(String message, String xpathExpression, SOAPMessage soapMessage) {
        XPathExpression expression = XPathExpressionFactory.createXPathExpression(xpathExpression, namespaces);
        Document document = soapMessage.getSOAPPart();
        Node node = expression.evaluateAsNode(document);
        Assert.assertNull(message, node);
    }
View Full Code Here

    private XPathExpression getXPathExpressionFromParameters(Map<String, Object> parameters) {
        String xpathExpression = getAndRemoveParameter(parameters, "expression", String.class);
        if (xpathExpression == null) {
            throw new RuntimeCamelException("Expression parameter is required when using XPath endpoint mapping");
        }
        XPathExpression expression = XPathExpressionFactory.createXPathExpression(xpathExpression);
        return expression;
    }
View Full Code Here

                addEndpointDispatcherToConfiguration(configuration, lookupKey);
            } else {
                addEndpointMappingToConfiguration(parameters, configuration);
            }
            if (EndpointMappingType.XPATHRESULT.equals(type)) {
                XPathExpression expression = getXPathExpressionFromParameters(parameters);
                configuration.setEndpointMappingKey(new EndpointMappingKey(type, lookupKey, expression));
            } else {
                configuration.setEndpointMappingKey(new EndpointMappingKey(type, lookupKey, null));
            }
        }
View Full Code Here

    private XPathExpression getXPathExpressionFromParameters(Map<String, Object> parameters) {
        String xpathExpression = getAndRemoveParameter(parameters, "expression", String.class);
        if (xpathExpression == null) {
            throw new RuntimeCamelException("Expression parameter is required when using XPath endpoint mapping");
        }
        XPathExpression expression = XPathExpressionFactory.createXPathExpression(xpathExpression);
        return expression;
    }
View Full Code Here

    private XPathExpression getXPathExpressionFromParameters(Map<String, Object> parameters) {
        String xpathExpression = getAndRemoveParameter(parameters, "expression", String.class);
        if (xpathExpression == null) {
            throw new RuntimeCamelException("Expression parameter is required when using XPath endpoint mapping");
        }
        XPathExpression expression = XPathExpressionFactory.createXPathExpression(xpathExpression);
        return expression;
    }
View Full Code Here

                addEndpointDispatcherToConfiguration(configuration, lookupKey);
            } else {
                addEndpointMappingToConfiguration(parameters, configuration);
            }
            if (EndpointMappingType.XPATHRESULT.equals(type)) {
                XPathExpression expression = getXPathExpressionFromParameters(parameters);
                configuration.setEndpointMappingKey(new EndpointMappingKey(type, lookupKey, expression));
            } else {
                configuration.setEndpointMappingKey(new EndpointMappingKey(type, lookupKey, null));
            }
        }
View Full Code Here

    private XPathExpression getXPathExpressionFromParameters(Map<String, Object> parameters) {
        String xpathExpression = getAndRemoveParameter(parameters, "expression", String.class);
        if (xpathExpression == null) {
            throw new RuntimeCamelException("Expression parameter is required when using XPath endpoint mapping");
        }
        XPathExpression expression = XPathExpressionFactory.createXPathExpression(xpathExpression);
        return expression;
    }
View Full Code Here

TOP

Related Classes of org.springframework.xml.xpath.XPathExpression

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.