Exemplo 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();
 }
Exemplo 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;
  }
Exemplo 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");
 }