xml
Class DOMEcho

java.lang.Object
  extended by xml.DOMEcho

public class DOMEcho
extends Object

Program to echo a DOM tree using DOM Level 2 interfaces. Use JAXP to read in and create a DOM tree. DOM currently does not provide a method to do this. (This is planned for Level 3.) See the method main for the three basic steps. Once the application obtains a DOM Document tree, it dumps out the nodes in the tree and associated node attributes for each node. Notes: Program flags may be used to create possibly non-conformant (but useful) DOM trees. Program also shows an example of using an ErrorHandler.


Nested Class Summary
private static class DOMEcho.MyErrorHandler
           
 
Field Summary
private static String basicIndent
          Indentation will be in multiples of basicIndent
private static int indent
          Indent level
private static PrintWriter out
          Output goes here
(package private) static String outputEncoding
          All output will be use this encoding
 
Constructor Summary
DOMEcho(PrintWriter out)
           
 
Method Summary
static void echo(Node n)
          Recursive routine to print out DOM tree nodes
static void main(String[] args)
           
private static void outputIndentation()
          Indent to the current level in multiples of basicIndent
private static void printlnCommon(Node n)
          Echo common attributes of a DOM2 Node and terminate output with an EOL character.
private static void usage()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

outputEncoding

static final String outputEncoding
All output will be use this encoding

See Also:
Constant Field Values

out

private static PrintWriter out
Output goes here


indent

private static int indent
Indent level


basicIndent

private static final String basicIndent
Indentation will be in multiples of basicIndent

See Also:
Constant Field Values
Constructor Detail

DOMEcho

DOMEcho(PrintWriter out)
Method Detail

printlnCommon

private static void printlnCommon(Node n)
Echo common attributes of a DOM2 Node and terminate output with an EOL character.


outputIndentation

private static void outputIndentation()
Indent to the current level in multiples of basicIndent


echo

public static void echo(Node n)
Recursive routine to print out DOM tree nodes


usage

private static void usage()

main

public static void main(String[] args)
                 throws Exception
Throws:
Exception