Eclipse Tips: Debugging XML

When using dom4j objects in Eclipse, it is sometimes hard to determine what the contents of a particular Document or Element are:

Step into code that uses an Element, Document, etc
  • Open the Variables view, right click on the object, and select “New Detail Formatter”:
  • Enter the following code:
  • sw = new; format =; writer = new sw, format ); 
    return sw.toString();
  • Click OK. You will now see a more readable format for your Dom4j objects: