}
Iterator it = children.iterator();
while(it.hasNext()) {
Node child = (Node) it.next();
switch(child.getType()) {
case USER: {
padding(buffer, level + 1);
buffer.append("<user>" + child.safe(USER_NAME) + "</user>\n");
} break;
case COMMENT: {
Data state = child.meta(COMMENT_STATE);
boolean show = (state == null ? false : state.getString().equals("SHOW"));
if(show) {
Data from = child.meta(COMMENT_IP);
if(from == null) {
try {
from = ((Node) child.child(USER).getFirst()).meta(USER_NAME);
}
catch(SQLException e) {
e.printStackTrace();
}
}
padding(buffer, level + 1);
buffer.append("<post>\n");
padding(buffer, level + 2);
buffer.append("<body>" + child.safe(COMMENT_BODY) + "</body>\n");
padding(buffer, level + 2);
buffer.append("<from>" + from.getString() + "</from>\n");
padding(buffer, level + 2);
buffer.append("<date>" + child.getDate() + "</date>\n");
padding(buffer, level + 1);
buffer.append("</post>\n");
}
} break;
case FILE: {
padding(buffer, level + 1);
buffer.append("<file>\n");
padding(buffer, level + 2);
buffer.append("<type>" + child.safe(FILE_TYPE) + "</type>\n");
padding(buffer, level + 2);
buffer.append("<path>file" + child.path() + "/" + Sprout.clean(child.safe(FILE_NAME)) + "</path>\n");
padding(buffer, level + 1);
buffer.append("</file>\n");
} break;
case PING: {
Data state = child.meta(PING_STATE);
boolean show = (state == null ? false : state.getString().equals("SHOW"));
if(show) {
padding(buffer, level + 1);
buffer.append("<ping>" + Sprout.clean(child.safe(PING_URL)) + "</ping>\n");
}
} break;
}
}