DTMNodeList returns list containing single element ([A]) instead of just that element (A) in Apache Camel
Issue
- We am using Apache Velocity template to format output from route.
- We are able to access
${exchange.getProperty("CamelSplitIndex")}but not able to access
${exchange.properties.a} and
${exchange.getProperty("Description")}
-
We are getting --
com.sun.org.apache.xml.internal.dtm.ref.DTMNodeList@456e2finstead of value of the property. -
Here is part of the code:
<camel:convertBodyTo type="java.lang.String"></camel:convertBodyTo>
<to uri="xslt:XSLT/TxtToXMLConversion.xslt"></to>
<camel:setProperty propertyName="a">
<xpath>//*[local-name()="a"]/text()</xpath>
</camel:setProperty>
<camel:setProperty propertyName="Description">
<xpath>//*[local-name()="Description"]/text()</xpath>
</camel:setProperty>
<!-- <camel:setBody>
<camel:simple>Record# ${property.CamelSplitIndex}|${property.a}|${property.Description}\r\n</camel:simple>
</camel:setBody> -->
<camel:log message="Fetching a... ${property.a}" loggingLevel="INFO" ></camel:log>
<camel:log message="Fetching Desc... ${property.Description}" loggingLevel="INFO" ></camel:log>
<camel:log message="Transformed body# ${body}" loggingLevel="INFO"></camel:log>
- The XML file is as below,
<XML>
<MessageType>1</MessageType>
<ProcCode>FNTF</ProcCode>
<a>0168</a>
<Description> KSM0168 Different currency</Description>
</XML>
- Why does Camel return a list of Nodes rather than single values ? How can we return single values ?
Environment
- Red Hat JBoss Fuse
- 6.x
- Apache Camel
- camel-xpath component
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
