I have committed a modification in camel bindy to be able to work with ",".
that means that we use as separator the double quotes --> '","' 

See test class
https://svn.apache.org/repos/asf/camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyDoubleQuotesCsvUnmarshallTest.java
 

to have an example 

KR,

Charles

Claus Ibsen-2 wrote:
> 
> On Tue, May 4, 2010 at 5:19 PM, Claus Ibsen <claus.ib...@gmail.com> wrote:
>> Hi
>>
>> On Tue, May 4, 2010 at 8:57 AM, Attilio Donà <attilio.d...@gmail.com>
>> wrote:
>>>
>>> Hi all,
>>>
>>> I've to read a csv file and I want use camel to do this. Camel bindy
>>> seems
>>> to me that doesn't know the csv convention that a field separator can be
>>> a
>>> character field using double quotes:
>>>
>>> "contains,  comma", "another field"
>>>
>>
>> Yeah that would be good to be able to do with camel-bindy. Do you mind
>> creating a JIRA ticket?
>>
> 
> I have created the JIRA ticket
> https://issues.apache.org/activemq/browse/CAMEL-2691
> 
> 
>>
>>> So the adopted solution is camel-csv.
>>>
>>> Using camel-csv to parse the csv file as in the camel manual works only
>>> if
>>> the csv file has more than one line of data:
>>>
>>> // Some comments here
>>> public void doHandleCsvData(List> csvData)
>>> {
>>>    // do magic here as in the manual if the file as more than one row of
>>> data
>>> }
>>>
>>> If the csv file has 1 row the parameter passed to the method bean
>>> doHandleCsvData is a List.
>>>
>>> As a quick workaround, instead of using parametrized generics, it is
>>> possible to do something like this:
>>>
>>>
>>>         public void modelsCsvFile(Exchange exchange) {
>>>                 List csvData = (List) exchange.getIn().getBody();
>>>
>>>                 if (csvData.get(0).getClass().equals(String.class)) {
>>>                         log.debug("single row file");
>>>
>>>                         Vendor vendor =
>>> vendorDAO.bind((String)csvData.get(0));
>>>                         Model model = new Model(vendor,
>>> (String)csvData.get(1));
>>>                         modelDAO.bind(model);
>>>                         return;
>>>                 }
>>>
>>>                 for (List row : (List)csvData) {
>>>                         log.debug("read [{}] [{}]", row.get(0),
>>> row.get(1));
>>>
>>>                         Vendor vendor =
>>> vendorDAO.bind((String)row.get(0));
>>>                         Model model = new Model(vendor,
>>> (String)row.get(1));
>>>                         modelDAO.bind(model);
>>>
>>>                 }
>>>
>>> Attilio
>>>
>>> --
>>> View this message in context:
>>> http://old.nabble.com/Camel-csv-2.2.0%3A-reading-a-single-line-csv-file-tp28443740p28443740.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
> 
> 


-----
Charles Moulliard
SOA Architect

My Blog :  http://cmoulliard.blogspot.com/ http://cmoulliard.blogspot.com/  
-- 
View this message in context: 
http://old.nabble.com/Camel-csv-2.2.0%3A-reading-a-single-line-csv-file-tp28443740p28888858.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to