Menu

Tabbed delimited data

Help
2003-12-21
2003-12-24
  • Mitch Christensen

    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

     
    • Mitch Christensen

      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

       
    • bruce mcdonald

      bruce mcdonald - 2003-12-24

      Thanks for the leg work - I have made the fix to the CVS.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.