Products | Versions |
---|---|
TIBCO ActiveMatrix BusinessWorks | - |
Not Applicable | - |
Resolution:
Description:
========
How to parse a CSV file in which the Cell contains the Carriage Return (CR) character.
Environment:
========
ALL
Resolution:
========
When editing a CSV file in Excel, some cells may contain several lines. Those lines are also marked by CR. Since some CSV files may also use CR as the global line separator, BW will not be able to parse such a file using "Parse Data Activity" correctly. In this case, use custom Java code to parse the CSV file and then covert the data back to an XML format. Refer to the attached sample project (Filename: CSVParser.zip).
1). Custom Java code for parsing CSV file.
- Create a Java POJO class which will act as the data wrapper for a single line of CSV file. For example, if you have three columns in a CSV file, you would need to define three instance variables in the POJO as well as the Getter/Setter method.