replaced all StringBuffers with StringBuilder to improve performance
[Bob.git] / src / com / interrupt / bob / base / ToXMLVisitorPass2.java
blob6e86150f8f303d942374d0c4a90cf7ba7f930b80
1 package com.interrupt.bob.base;
4 import java.util.List;
5 import org.xml.sax.Attributes;
7 /**
8 * Assemble the XML string
9 */
10 public class ToXMLVisitorPass2 implements ISaxVisitor {
12 private String parentns = null;
13 private StringBuilder xmlString = null;
14 private int formatDepth = 0;
16 public ToXMLVisitorPass2() {
17 parentns = "";
18 xmlString = new StringBuilder();
21 public String getXML() {
22 if(xmlString == null) {
23 return null;
25 return xmlString.toString();
28 public void visitStart(IBob bob) {
30 //** formatted
31 //for(int i = 0; i < formatDepth; i++) {
32 // xmlString.append("\t");
33 //}
34 //formatDepth +=1;
36 String ostring = bob._getOpenString();
37 if( (ostring != null) && (ostring.trim().length() > 0) ) {
38 xmlString.append(ostring);
41 //xmlString.append("\n");
44 public void visitEnd(IBob bob) {
46 //** formatted
47 //for(int i = 0; i < formatDepth; i++) {
48 // xmlString.append("\t");
49 //}
50 //formatDepth -=1;
52 String cstring = bob._getCloseString();
53 if( (cstring != null) && (cstring.trim().length() > 0) ) {
54 xmlString.append(cstring);
57 //xmlString.append("\n");