camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hans-christian <hans-christian.herbert.goeran...@regionh.dk>
Subject Re: Problem to write quotes correct on CSV-fields when marshalling with CsvDataFormat
Date Mon, 20 Apr 2015 09:17:32 GMT
Hi!

I tested with the suggested change and now I have qoutes at all fields,
which solves my issue.
Thanks!


yogu13 wrote
> Thank you for the test case... I am assuming you are using camel-csv
> component here
> 
> In that case couple of things i noticed would require a change:-
> 
> 1. Use org.apache.camel.dataformat.csv.CsvDataFormat (This has its own
> DataFormat defined as well)
> 2. The Dataformat would be set as below
>                         final CsvDataFormat csv = new CsvDataFormat(); 
> 	                csv.setLazyLoad(Boolean.FALSE); 
> 	                csv.setDelimiter(Character.valueOf(';'));	                 
> 	                csv.setRecordSeparator("\r\n"); 
> 	                csv.setIgnoreSurroundingSpaces(Boolean.FALSE); 
> 	                csv.setQuoteDisabled(Boolean.FALSE);
> 	                csv.setQuoteMode(QuoteMode.ALL);
> 3. Include a dependency for 
>            
> <dependency>
>               
> <groupId>
> org.apache.commons
> </groupId>
>               
> <artifactId>
> commons-csv
> </artifactId>
>               
> <version>
> 1.0
> </version>
>           
> </dependency>
> 4. The ouput then generated would be 
>         String output = "\"ABC\";\"DEF \";\"GHI\"\r\n";
> 
> 
> Hope this helps!
> 
> Regards,
> -Yogesh





--
View this message in context: http://camel.465427.n5.nabble.com/Problem-to-write-quotes-correct-on-CSV-fields-when-marshalling-with-CsvDataFormat-tp5765477p5766055.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message