camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andy Bourke <andy.bou...@pcmsgroup.com>
Subject marshal to CSV with pipe delimiter
Date Thu, 10 Jun 2010 12:09:53 GMT

I have successfully configured my spring XML to unmarshal a file delimited by
pipe symbols using the following:

<unmarshal>
    <csv id="usePipeCsv"/>
</unmarshal>

with the readPipeCsv bean configured as:

    <bean name="usePipeCsv"
class="org.apache.camel.dataformat.csv.CsvDataFormat">
        <property name="strategy.delimiter" value="|"/>
    </bean>

However, the same technique does not work when trying to marshal the CSV
data, i.e. the output has comma delimited values instead of being pipe
delimited.

<marshal>
    <csv id="usePipeCsv"/>
</marshal>


So I tried to set the delimiter in the CSVConfig using the following config:

            <marshal>
                <csv id="writePipeCsv"/>
            </marshal>

    <bean name="writePipeCsv"
class="org.apache.camel.dataformat.csv.CsvDataFormat">
        <property name="config">
            <bean class="org.apache.commons.csv.writer.CSVConfig">
                <property name="delimiter" value="|"/>
            </bean>
        </property>
    </bean>

Although this works from a compile and run point of view, the output is
delimited by comma instead of pipe.

I'm obviously doing something wrong - can you point me in the right
direction please?



-- 
View this message in context: http://old.nabble.com/marshal-to-CSV-with-pipe-delimiter-tp28842183p28842183.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message