public void dump(PrintStream psOut,int indentAmount){
  PrintWriter out;
  try {
    out=new PrintWriter(new OutputStreamWriter(psOut,"JavaEsc"),true);
  }
 catch (  UnsupportedEncodingException e) {
    out=new PrintWriter(psOut,true);
  }
  indent(out,indentAmount);
  if (getName() == null) {
    out.print("<??");
  }
 else {
    out.print("<" + getName());
  }
  if (getAttributeCount() > 0) {
    out.println("");
    Enumeration names=attributes.getAttributeNames();
    while (names.hasMoreElements()) {
      Object name=names.nextElement();
      indent(out,indentAmount + 1);
      out.println(name + "=" + getAttribute(name));
    }
    indent(out,indentAmount);
  }
  out.println(">");
  if (isLeaf()) {
    indent(out,indentAmount + 1);
    out.print("[" + getStartOffset() + ","+ getEndOffset()+ "]");
    Content c=getContent();
    try {
      String contentStr=c.getString(getStartOffset(),getEndOffset() - getStartOffset());
      if (contentStr.length() > 40) {
        contentStr=contentStr.substring(0,40) + "...";
      }
      out.println("[" + contentStr + "]");
    }
 catch (    BadLocationException e) {
    }
  }
 else {
    int n=getElementCount();
    for (int i=0; i < n; i++) {
      AbstractElement e=(AbstractElement)getElement(i);
      e.dump(psOut,indentAmount + 1);
    }
  }
}

public void dump ( PrintStream psOut , int indentAmount ) { PrintWriter out ; try { out = new PrintWriter ( new OutputStreamWriter ( psOut , "JavaEsc" ) , true ) ; } catch ( UnsupportedEncodingException e ) { out = new PrintWriter ( psOut , true ) ; } indent ( out , indentAmount ) ; if ( getName ( ) == null ) { out . print ( "<??" ) ; } else { out . print ( "<" + getName ( ) ) ; } if ( getAttributeCount ( ) > 0 ) { out . println ( "" ) ; Enumeration names = attributes . getAttributeNames ( ) ; while ( names . hasMoreElements ( ) ) { Object name = names . nextElement ( ) ; indent ( out , indentAmount + 1 ) ; out . println ( name + "=" + getAttribute ( name ) ) ; } indent ( out , indentAmount ) ; } out . println ( ">" ) ; if ( isLeaf ( ) ) { indent ( out , indentAmount + 1 ) ; out . print ( "[" + getStartOffset ( ) + "," + getEndOffset ( ) + "]" ) ; Content c = getContent ( ) ; try { String contentStr = c . getString ( getStartOffset ( ) , getEndOffset ( ) - getStartOffset ( ) ) ; if ( contentStr . length ( ) > 40 ) { contentStr = contentStr . substring ( 0 , 40 ) + "..." ; } out . println ( "[" + contentStr + "]" ) ; } catch ( BadLocationException e ) { } } else { int n = getElementCount ( ) ; for ( int i = 0 ; i < n ; i ++ ) { AbstractElement e = ( AbstractElement ) getElement ( i ) ; e . dump ( psOut , indentAmount + 1 ) ; } } }
dumps a debugging representation of the element hierarchy .
