protected void extractColumns()

in src/main/java/org/apache/servicemix/components/util/SimpleFlatFileMarshaler.java [465:509]


    protected void extractColumns(StringBuffer buffer, String lineText,
            Iterator lines) {
        String[] rawcolContents = this.extractColumnContents(lineText, lines);

        if ((rawcolContents != null) && (rawcolContents.length > 0)) {
            for (int i = 0; i < rawcolContents.length; i++) {
                String colText = rawcolContents[i];

                String colName = this.findColumnname(i);
                String colContents = this.convertColumnContents(i, colText);

                if (colContents == null) {
                    // Simple skip
                    // Or maybe insert NULL Element
                } else {
                    if (!((colContents.length() == 0)
                            && (this.skipAnyEmptyCols || (this.skipKnownEmptyCols && (!this.columnElementname.equals(colName)))))) {
                        if (this.insertColContentInAttribut) {
                            buffer.append(XML_OPEN + colName);

                            if (this.insertColNumbers) {
                                buffer.append(" number=\"");
                                buffer.append(i + 1);
                                buffer.append("\"");
                            }
                            buffer.append(" value=\"");
                            buffer.append(colContents);
                            buffer.append("\"/>");
                        } else {
                            if (!this.insertColNumbers) {
                                buffer.append(XML_OPEN + colName + XML_CLOSE);
                            } else {
                                buffer.append(XML_OPEN + colName);
                                buffer.append(" number=\"");
                                buffer.append(i + 1);
                                buffer.append("\"/>");
                            }
                            buffer.append(colContents);
                            buffer.append(XML_OPEN_END + colName + XML_CLOSE);
                        }
                    }
                }
            }
        }
    }