I am working with CSV data and making great progress. Unfortunately, our files are tab-delimited, and we have no control over this.
So far, I've had no luck configuring the FlatToXml processor to use TAB characters as field/column separators. I've tried various <field-separator/> values including TAB (whitespace), '\t', etc.
I suppose that I could preprocess the file somehow to replace the tabs with some other character, but is seems as though TAB delimited text is common enough that it should be supported.
TIA,
-Mitch
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am working with CSV data and making great progress. Unfortunately, our files are tab-delimited, and we have no control over this.
So far, I've had no luck configuring the FlatToXml processor to use TAB characters as field/column separators. I've tried various <field-separator/> values including TAB (whitespace), '\t', etc.
I suppose that I could preprocess the file somehow to replace the tabs with some other character, but is seems as though TAB delimited text is common enough that it should be supported.
TIA,
-Mitch
This turned out to be a tough one. I ended up having to hack the code a bit to get it to work.
I made the following change to com.babeldoc.conversion.flatfile.digester.InputDoucment.java:
/**
* Set the field separator charactor (CSV)
*
* @param fieldSeparator
* DOCUMENT ME!
*/
public void setFieldSeparator(String fieldSeparator) {
// System.out.println("[InputDocument.setFieldSeparator]:
// "+fieldSeparator);
if (fieldSeparator.equals("\\t")) {
this.fieldSeparator = "\t";
} else {
this.fieldSeparator = fieldSeparator;
}
}
This change allows me to do the following:
<field-separator>\t</field-separator>
in order to process tab-delimited files.
If you are interested in a full description of the problem/symptom, see bug #865405
-Mitch
Thanks for the leg work - I have made the fix to the CVS.