Esempio n. 1
0
 /** Express the segment as a string */
 public String toString() {
   StringBuffer sb = new StringBuffer();
   sb.append(this.getName() + "__" + this.getXmlPath() + ":");
   for (CSVField field : this.getFields()) {
     sb.append("," + field.getName() + ":" + field.getValue());
   }
   return sb.toString();
 }
Esempio n. 2
0
  /**
   * Find the child field with the given name
   *
   * @param childName
   * @return
   */
  public CSVField getFieldByName(String childName) {
    for (CSVField childField : this.getFields())
      if (childField
          .getName()
          .equals(childName)) // .equalsIgnoreCase(childName))//.equals(childName))
      return childField;

    return null;
  }
Esempio n. 3
0
 private void processCsvSegment(CSVSegment seg, String indent) {
   // process CSV fields
   xmlBuffer.append(indent + "<" + seg.getName());
   for (CSVField field : seg.getFields()) {
     xmlBuffer.append(" " + field.getName() + "=\"" + field.getValue() + "\"");
   }
   xmlBuffer.append(">\n");
   // process child CSV segments
   for (CSVSegment childSeg : seg.getChildSegments()) {
     processCsvSegment(childSeg, indent + "\t");
   }
   xmlBuffer.append(indent + "</" + seg.getName() + ">\n");
 }