camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mitul1411 <mitul.1...@gmail.com>
Subject Re: XPath Spliiter Problem
Date Thu, 22 Apr 2010 10:00:40 GMT

I used file  output for testing the values.
My requirement is that I have to send the values from the nodes to the CXF
endpoint.
Adding a bean would mean an overhead to the route.
I need your suggestions on it.


Claus Ibsen-2 wrote:
> 
> Hi
> 
> You can convert that yourself in a processor / bean
> 
> // use iterator to walk the XML
> Iterator it = exchange.getIn().getBody(Iterator.class);
> while (it.hasNext()) {
>    Object value = it.next();
>    String s =
> exchange.getContext().getTypeConverter().convertTo(String.class,
> value);
>    // now add the str to something
> }
> 
> // and replace the body
> exchange.getIn().setBody(myStringWithXml);
> 
> 
> But we should maybe add some default type converter to Camel that can
> work with the XPath types
> 
> 
> On Thu, Apr 22, 2010 at 11:13 AM, mitul1411 <mitul.1411@gmail.com> wrote:
>>
>> When I do not provide any resultType (i.e. using the default one) , I get
>> the
>> following error.
>>
>> No type converter available to convert from type:
>> com.sun.org.apache.xerces.internal.dom.DeferredElementNSImpl to the
>> required
>> type: java.io.InputStream with value [cone: null]
>>
>> The above statement is one of the excerpts from the whole stack trace.
>>
>>
>>
>> Claus Ibsen-2 wrote:
>>>
>>> Do not use resultType="java.lang.String"
>>>
>>> By default it uses some XPath standard type (NODESET) which is defined
>>> in
>>> javax.xml.xpath.XPathConstants
>>>
>>> The NODESET should be able to contain multiple nodes in the result.
>>>
>>>
>>>
>>> On Thu, Apr 22, 2010 at 10:56 AM, mitul1411 <mitul.1411@gmail.com>
>>> wrote:
>>>>
>>>> Hello everyone,
>>>> I am not an advanced user of Camel.
>>>> When I use XPath Splitter , I get only one record in the result. How do
>>>> I
>>>> get multiple records ?
>>>>
>>>> For example :
>>>> My XML file is
>>>>
>>>>
>>>>  <cone>abc</cone>
>>>>  <ctwo>xyz</ctwo>
>>>>
>>>>
>>>>
>>>>  <cone>abc123</cone>
>>>>  <ctwo>xyz123</ctwo>
>>>>
>>>>
>>>>
>>>>  <cone>abcqqq</cone>
>>>>  <ctwo>xyzqqq</ctwo>
>>>>
>>>>
>>>> </c>
>>>>
>>>> I use the following configuration in the xml file :
>>>>
>>>> <camelContext xmlns="http://camel.apache.org/schema/spring"
>>>> id="xpathrouter">
>>>>        <route>
>>>>                <from uri="activemq:queue:myqueue" />
>>>>                <split>
>>>>                        <xpath
>>>>  resultType="java.lang.String">/a/b/cone</xpath>
>>>>                        <to uri="file:/abc/messages/test" />
>>>>                </split>
>>>>        </route>
>>>> </camelContext>
>>>>
>>>> The result I get is : abc
>>>>
>>>> I also want abc123 and abcqqq in the result.
>>>>
>>>> Can anyone help me out ?
>>>>
>>>> Thank You.
>>>> --
>>>> View this message in context:
>>>> http://old.nabble.com/XPath-Spliiter-Problem-tp28325959p28325959.html
>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Claus Ibsen
>>> Apache Camel Committer
>>>
>>> Author of Camel in Action: http://www.manning.com/ibsen/
>>> Open Source Integration: http://fusesource.com
>>> Blog: http://davsclaus.blogspot.com/
>>> Twitter: http://twitter.com/davsclaus
>>>
>>>
>>
>> --
>> View this message in context:
>> http://old.nabble.com/XPath-Spliiter-Problem-tp28325959p28326122.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
> 
> 
> 
> -- 
> Claus Ibsen
> Apache Camel Committer
> 
> Author of Camel in Action: http://www.manning.com/ibsen/
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
> 
> 

-- 
View this message in context: http://old.nabble.com/XPath-Spliiter-Problem-tp28325959p28326725.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message