final String off = "\n" + offset;
if (node instanceof Element) {
String name = node.getNodeName();
// String value = node.getNodeValue();
NamedNodeMap attrs = node.getAttributes();
StringBuffer buf = new StringBuffer(128);
StringBuffer buf1 = new StringBuffer(50);
buf.append(off).append("<").append(name);
if (attrs != null && attrs.getLength() > 0) {
for (int i=0; i < attrs.getLength(); i++) {
Node attr = attrs.item(i);
buf.append(" ").append(attr.getNodeName()).append("='").append(attr.getNodeValue()).append("'");
}
}
boolean hasChilds = node.hasChildNodes();
if (!hasChilds) {