SNMP Stack 4_12

uk.co.westhawk.test
Class DOMWriter

java.lang.Object
  |
  +--uk.co.westhawk.test.DOMWriter

public class DOMWriter
extends java.lang.Object

This class prints a DOM (document object model) representation of a XML document.

Version:
$Revision: 1.4 $ $Date: 2002/10/10 15:13:57 $
Author:
Birgit Arkesteijn

Field Summary
protected  boolean canonical
          Canonical output (or not).
protected  java.lang.String docHeader
          The document header
protected  java.lang.String docType
          The document type
static java.lang.String PRINTWRITER_ENCODING
          Default Encoding
 
Constructor Summary
DOMWriter(boolean can, java.lang.String dH, java.lang.String dT)
          The constructor.
 
Method Summary
protected  java.lang.String normalize(java.lang.String s)
          Normalizes the given string.
 void print(org.w3c.dom.Node node)
          Prints the specified node with all its subnodes to System.out.
protected  void print(org.w3c.dom.Node node, int level, java.io.PrintWriter out)
          Prints the specified node, recursively.
 void print(org.w3c.dom.Node node, java.io.PrintWriter w)
          Prints the specified node with all its subnodes to a printwriter.
protected  org.w3c.dom.Attr[] sortAttributes(org.w3c.dom.NamedNodeMap attrs)
          Returns a sorted list of attributes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PRINTWRITER_ENCODING

public static java.lang.String PRINTWRITER_ENCODING
Default Encoding

canonical

protected boolean canonical
Canonical output (or not).

docHeader

protected java.lang.String docHeader
The document header

docType

protected java.lang.String docType
The document type
Constructor Detail

DOMWriter

public DOMWriter(boolean can,
                 java.lang.String dH,
                 java.lang.String dT)
The constructor. The dH and dT are needed since the information regarding any DTD is not stored in the DOM.
Parameters:
can - Canonical of not
dH - The document header
dT - The document type
Method Detail

print

public void print(org.w3c.dom.Node node)
Prints the specified node with all its subnodes to System.out.
Parameters:
node - The node to be printed.

print

public void print(org.w3c.dom.Node node,
                  java.io.PrintWriter w)
Prints the specified node with all its subnodes to a printwriter.
Parameters:
node - The node to be printed.
w - The writer to be printed to.

print

protected void print(org.w3c.dom.Node node,
                     int level,
                     java.io.PrintWriter out)
Prints the specified node, recursively.
Parameters:
node - The node to be printed.
w - The writer to be printed to.

sortAttributes

protected org.w3c.dom.Attr[] sortAttributes(org.w3c.dom.NamedNodeMap attrs)
Returns a sorted list of attributes.
Parameters:
attrs - The attributes.

normalize

protected java.lang.String normalize(java.lang.String s)
Normalizes the given string.
Parameters:
s - The string.

SNMP Stack 4_12