docs: public void write(Tree<?, ?> tree) throws IOException {
          this.writer.append("<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n"); //$NON-NLS-1$
          this.writer.append("<gxl>\n"); //$NON-NLS-1$
  
          if (tree != null) {
              this.writer.append("\t<graph id=\""); //$NON-NLS-1$
              this.writer.append(Integer.toHexString(System.identityHashCode(new Integer(tree.hashCode()))));
              this.writer.append("-"); //$NON-NLS-1$
              this.writer.append(Integer.toString(this.graphIndex++));
              this.writer.append("\" edgeids=\"true\" edgemode=\"directed\">\n"); //$NON-NLS-1$
  
              // Write the node attributes
              Iterator<? extends TreeNode<?, ?>> iterator = tree.broadFirstIterator();
              TreeNode<?, ?> node;
              int dataCount;
              while (iterator.hasNext()) {
                  node = iterator.next();
                  dataCount = node.getUserDataCount();
                  final String name = "NODE" + Integer.toHexString(node.hashCode()); //$NON-NLS-1$
                  final String label = Integer.toString(dataCount);
  
                  this.writer.append("\t\t<node id=\""); //$NON-NLS-1$
                  this.writer.append(name);
                  this.writer.append("\">\n"); //$NON-NLS-1$
  
                  this.writer.append("\t\t\t<attr name=\"label\">\n"); //$NON-NLS-1$
                  this.writer.append("\t\t\t\t<string>"); //$NON-NLS-1$
                  this.writer.append(label);
                  this.writer.append("</string>\n"); //$NON-NLS-1$
                  this.writer.append("\t\t\t</attr>\n"); //$NON-NLS-1$
  
                  this.writer.append("\t\t</node>\n"); //$NON-NLS-1$
              }
  
              // Write the node attributes
              iterator = tree.broadFirstIterator();
              TreeNode<?, ?> child;
              String childName;
              while (iterator.hasNext()) {
                  node = iterator.next();
                  final String name = "NODE" + Integer.toHexString(node.hashCode()); //$NON-NLS-1$
                  if (!node.isLeaf()) {
                      final int childCount = node.getChildCount();
                      for (int i = 0; i < childCount; ++i) {
                          child = node.getChildAt(i);
                          if (child != null) {
                              childName = "NODE" + Integer.toHexString(child.hashCode()); //$NON-NLS-1$
  
                              this.writer.append("\t\t<edge id=\""); //$NON-NLS-1$
                              this.writer.append(name);
                              this.writer.append("--"); //$NON-NLS-1$
                              this.writer.append(childName);
                              this.writer.append("\" isdirected=\"true\" from=\""); //$NON-NLS-1$
                              this.writer.append(name);
                              this.writer.append("\" to=\""); //$NON-NLS-1$
                              this.writer.append(childName);
                              this.writer.append("\">\n"); //$NON-NLS-1$
  
                              this.writer.append("\t\t\t<attr name=\"label\">\n"); //$NON-NLS-1$
                              this.writer.append("\t\t\t\t<string>"); //$NON-NLS-1$
                              this.writer.append(Integer.toString(i));
                              this.writer.append("</string>\n"); //$NON-NLS-1$
                              this.writer.append("\t\t\t</attr>\n"); //$NON-NLS-1$
  
                              this.writer.append("\t\t</edge>\n"); //$NON-NLS-1$
                          }
                      }
                  }
              }
  
              this.writer.append("\t</graph>\n"); //$NON-NLS-1$
          }
  
          this.writer.append("</gxl>\n"); //$NON-NLS-1$
      }