attribute사이에 개행문자 넣는 기능은 기본으로는 없지 않을까요?
하지만 어렵지 않게 만들 수 있을 것 같습니다.
pseudo-code입니다. xml 관련 함수명은 다를 수 있습니다.
void beautifyXML(XMlElement elem, Writer writer, int depth) {
for (int i = 0; i < depth; i++)
writer.printf("\t");
writer.printf("<" + elem.getTagName() + "\n");
for (int i = 0; i < elem.getAttrCount(); i++) {
Attribute atr = elem.getAttribute(i);
for (int j = 0; j < depth; i++)
writer.printf("\t");
writer.printf("\t" + atr.getName() + "=" + atr.getValue() + "\n");
}
for (int i = 0; i < elem.getChildCount(); i++)
beautifyXML(elem.getChildAt(i), writer, depth+1);
for (int i = 0; i < depth; i++)
writer.printf("\t");
printf("/" + elem.getTagName() + ">\n");
}
실제 부를 때,
beautifyXML(xml.getDocumentElement(), 0);