コード例 #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();
 }
コード例 #2
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");
 }