Hi Lakmali,


On Tue, Feb 17, 2015 at 10:23 AM, Lakmali Baminiwatta <[email protected]>
wrote:

> Hi Kalpa,
>
> Did you try the with csv:reader in Smooks mediator instead of
> resource-config?
>
>
Yes, but the result is the same.


> <?xml version="1.0" encoding="UTF-8"?>
> <localEntry xmlns="http://ws.apache.org/ns/synapse"; key="smooks-csv">
>    <smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd";
>                          xmlns:csv="
> http://www.milyn.org/xsd/smooks/csv-1.2.xsd";>
>
>  <csv:reader fields="Book,ISBN,Author,Comments" separator="&#09;"
> quote="~" rootElementName="Books" recordElementName="Book"/>
>
>    </smooks-resource-list>
>    <description/>
> </localEntry>
>
> Thanks,
> Lakmali
>
> On 17 February 2015 at 09:22, Kalpa Welivitigoda <[email protected]> wrote:
>
>> Hi,
>>
>> Smooks has " character as the default for quotes. According to smooks
>> documentation [1], smooks configuration has a "quote" attribute we can use
>> to set the quote character.
>>
>> I tried with the following local entry in esb as the smooks configuration
>> and the "quote" param has no effect over the output. My csv file has
>> records with " character, and without the quote param, the output is wrong
>> (some records are dropped). Also with setting the "quote" param to
>> something else like ~ character, the result is the same.
>>
>> What could have gone wrong here?
>>
>> On a side note, I tried the same with the Smooks csv-to-xml sample and it
>> works fine (by setting the "quote" attribute in csv:reader).
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <localEntry xmlns="http://ws.apache.org/ns/synapse"; key="smooks-csv">
>>    <smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd";
>>                          xmlns:csv="
>> http://www.milyn.org/xsd/smooks/csv-1.2.xsd";>
>>       <resource-config selector="org.xml.sax.driver">
>>          <resource>org.milyn.csv.CSVReader</resource>
>>          <param name="fields">Book,ISBN,Author,Comments</param>
>>         <param name="separator">&#09;</param>
>>         <param name="quote">~</param>
>>         <param name="rootElementName">Books</param>
>>         <param name="recordElementName">Book</param>
>>       </resource-config>
>>    </smooks-resource-list>
>>    <description/>
>> </localEntry>
>>
>>
>> [1]
>> http://www.smooks.org/mediawiki/index.php?title=V1.5:Smooks_v1.5_User_Guide
>>
>> <?xml version="1.0"?>
>> <smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"; 
>> xmlns:csv="http://www.milyn.org/xsd/smooks/csv-1.5.xsd";>
>>
>>     <!--
>>     Configure the CSV to parse the message into a stream of SAX events.
>>     -->
>>     <csv:reader fields="firstname,lastname,gender,age,country" separator="|" 
>> quote="'" skipLines="1" />
>>
>> </smooks-resource-list>
>>
>>
>>
>> --
>> Best Regards,
>>
>> Kalpa Welivitigoda
>> Software Engineer, WSO2 Inc. http://wso2.com
>> Email: [email protected]
>> Mobile: +94776509215
>>
>
>
>
> --
> Lakmali Baminiwatta
>  Senior Software Engineer
> WSO2, Inc.: http://wso2.com
> lean.enterprise.middleware
> mobile:  +94 71 2335936
> blog : lakmali.com
>
>


-- 
Best Regards,

Kalpa Welivitigoda
Software Engineer, WSO2 Inc. http://wso2.com
Email: [email protected]
Mobile: +94776509215
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to