You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "anish.somadevan" <ne...@gmail.com> on 2015/08/06 07:11:28 UTC
Parsing a XML in DSL
Am trying to parse the input XML of a route to get a particular node's value.
I tried this way,
<xpath>/CamelData/Provider/text()</xpath>
But this throws an error,
java.lang.ClassCastException: org.apache.xml.dtm.ref.DTMManagerDefault
cannot be cast to org.apache.xml.dtm.DTMManager:
java.lang.ClassCastException: org.apache.xml.dtm.ref.DTMManagerDefault
cannot be cast to org.apache.xml.dtm.DTMManager
at org.apache.xml.dtm.DTMManager.newInstance(DTMManager.java:137)
[xalan.jar:]
at org.apache.xpath.XPathContext.<init>(XPathContext.java:102) [xalan.jar:]
at org.apache.xpath.XPathContext.<init>(XPathContext.java:349) [xalan.jar:]
at
org.apache.xpath.jaxp.XPathExpressionImpl.eval(XPathExpressionImpl.java:113)
at
org.apache.xpath.jaxp.XPathExpressionImpl.eval(XPathExpressionImpl.java:99)
at
org.apache.xpath.jaxp.XPathExpressionImpl.evaluate(XPathExpressionImpl.java:184)
at
org.apache.camel.builder.xml.XPathBuilder.doInEvaluateAs(XPathBuilder.java:860)
[camel-core-2.10.3.jar:2.10.3]
Is there a way to get this resolved, or a better approach to parse the XML
in DSL?
Thanks,
Anish
--
View this message in context: http://camel.465427.n5.nabble.com/Parsing-a-XML-in-DSL-tp5770368.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Parsing a XML in DSL
Posted by Christian Müller <ch...@gmail.com>.
You should use Saxon for many reasons...
I suggest adding the camel-saxon dependency and use:
<xpath saxon="true">/CamelData/Provider/text()</xpath>
Best,
Christian
-----------------
Software Integration Specialist
Apache Member
V.P. Apache Camel | Apache Camel PMC Member | Apache Camel committer
Apache Incubator PMC Member
https://www.linkedin.com/pub/christian-mueller/11/551/642
On Sat, Aug 8, 2015 at 1:33 AM, anish.somadevan <ne...@gmail.com> wrote:
> I was able to resolve it by uploading a new version of xalan jar
>
> Thanks
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Parsing-a-XML-in-DSL-tp5770368p5770445.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
Re: Parsing a XML in DSL
Posted by "anish.somadevan" <ne...@gmail.com>.
I was able to resolve it by uploading a new version of xalan jar
Thanks
--
View this message in context: http://camel.465427.n5.nabble.com/Parsing-a-XML-in-DSL-tp5770368p5770445.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Parsing a XML in DSL
Posted by "anish.somadevan" <ne...@gmail.com>.
I tried as you suggested, but still i get the same error,
<convertBodyTo type="String"/>
<xpath>/CamelData/Provider/text()</xpath>
Exhausted after delivery attempt: 1 caught: java.lang.ClassCastException:
org.apache.xml.dtm.ref.DTMManagerDefault cannot be cast to
org.apache.xml.dtm.DTMManager: java.lang.ClassCastException:
org.apache.xml.dtm.ref.DTMManagerDefault cannot be cast to
org.apache.xml.dtm.DTMManager
at org.apache.xml.dtm.DTMManager.newInstance(DTMManager.java:137)
[xalan.jar:]
at org.apache.xpath.XPathContext.<init>(XPathContext.java:102) [xalan.jar:]
at org.apache.xpath.XPathContext.<init>(XPathContext.java:349) [xalan.jar:]
at
org.apache.xpath.jaxp.XPathExpressionImpl.eval(XPathExpressionImpl.java:113)
at
org.apache.xpath.jaxp.XPathExpressionImpl.eval(XPathExpressionImpl.java:99)
Is there something that am missing?
Thanks,
Anish
--
View this message in context: http://camel.465427.n5.nabble.com/Parsing-a-XML-in-DSL-tp5770368p5770391.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Parsing a XML in DSL
Posted by Gnanaguru S <gn...@gmail.com>.
Looks like your message is not in the expected format. Add a convertBodyTo
String before xpath. It should work.
--
View this message in context: http://camel.465427.n5.nabble.com/Parsing-a-XML-in-DSL-tp5770368p5770375.html
Sent from the Camel - Users mailing list archive at Nabble.com.