
import org.w3c.dom.*;
import java.io.*;


public class PrettyPrintVisitor extends Visitor {

	private String prefix =
		new String(".............................");

	protected void visit(Element node) throws VisitorException {
		String start = prefix.substring(0, depthCounter);
		System.out.println(start + "Element node: " + name );
	}

	protected void visit(Text node) throws VisitorException {
		if (!value.equals("")) {
			String start = prefix.substring(0, depthCounter);
			System.out.println(start + "Text node:   " + value);
		}
	}

	protected void visit(Attr node) throws VisitorException {
		String start = prefix.substring(0, depthCounter);
		System.out.print(start + "(Attribute node: ");
		System.out.println(node.getName() + " = " + node.getValue() + ")");
	}
}

