So I've ended up writing a little piece of code to remove whitespace text nodes:
public static void removeWhitespaceNodes(Branch a_branch) { for (int i = 0; i < a_branch.nodeCount(); i++) { Node checkNode = a_branch.node(i); if (checkNode.getNodeType() == Node.TEXT_NODE) { if (checkNode.getText().trim().equals("")) { checkNode.detach(); } } else if (checkNode.getNodeType() == Node.ELEMENT_NODE) { removeWhitespaceNodes((Element)checkNode); } } } ------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ dom4j-user mailing list dom4j-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dom4j-user