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 Fri, 14 May 2010 06:35:42 GMT

Thanks a lot for helping me out.
What is the release date of Camel 2.3 ?


Claus Ibsen-2 wrote:
> 
> Hi
> 
> I have implemented this in Camel 2.3 so it can do your example out of the
> box.
> 
> 
> On Thu, Apr 22, 2010 at 12:10 PM, Claus Ibsen <claus.ibsen@gmail.com>
> wrote:
>> On Thu, Apr 22, 2010 at 12:00 PM, mitul1411 <mitul.1411@gmail.com> wrote:
>>>
>>> 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.
>>>
>>
>> There is not much overhead in a bean / processor than the convertBodyTo
>> You gotta do the same, convert the XPath result to something that can
>> be streamed to a file.
>>
>> I have created a ticket to create type converters out of the box in Camel
>> https://issues.apache.org/activemq/browse/CAMEL-2669
>>
>>>
>>> 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.
>>>
>>>
>>
>>
>>
>> --
>> 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
>>
> 
> 
> 
> -- 
> 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-Splitter-Problem-tp28325959p28555777.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message