Search in sources :

Example 21 with XPathExpression

use of org.springframework.xml.xpath.XPathExpression in project spring-integration by spring-projects.

the class XPathTransformerTests method xpathExpressionReferenceConstructorInsteadOfString.

@Test
public void xpathExpressionReferenceConstructorInsteadOfString() throws Exception {
    XPathExpression expression = XPathExpressionFactory.createXPathExpression("/parent/child/@name");
    XPathTransformer transformer = new XPathTransformer(expression);
    Object result = transformer.doTransform(message);
    assertEquals("test", result);
}
Also used : XPathExpression(org.springframework.xml.xpath.XPathExpression) Test(org.junit.Test)

Aggregations

XPathExpression (org.springframework.xml.xpath.XPathExpression)21 Test (org.junit.Test)18 Document (org.w3c.dom.Document)9 GenericMessage (org.springframework.messaging.support.GenericMessage)7 Node (org.w3c.dom.Node)2 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 DocumentBuilder (javax.xml.parsers.DocumentBuilder)1 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)1 EndpointMappingKey (org.apache.camel.component.spring.ws.type.EndpointMappingKey)1 EndpointMappingType (org.apache.camel.component.spring.ws.type.EndpointMappingType)1 HttpMessageConversionException (org.springframework.http.converter.HttpMessageConversionException)1 HttpMessageNotReadableException (org.springframework.http.converter.HttpMessageNotReadableException)1 HttpMessageNotWritableException (org.springframework.http.converter.HttpMessageNotWritableException)1 XPathException (org.springframework.xml.xpath.XPathException)1