org.cdlib.xtf.util
Class XMLWriter

Object
  extended by XMLWriter

public class XMLWriter
extends Object

Simple utility class that takes a Node or Source (representing an XML document) and produces an indented string representation of it. This is very useful for debugging.

Author:
Martin Haye

Constructor Summary
XMLWriter()
           
 
Method Summary
static void debug(EasyNode node)
          Prints the node, in XML format, to Trace.debug()
static void debug(EasyNode node, boolean includeXMLDecl)
          Prints the node, in XML format, to Trace.debug()
static void debug(Source node)
          Prints the node, in XML format, to Trace.debug()
static void debug(Source node, boolean includeXMLDecl)
          Prints the node, in XML format, to Trace.debug()
static String toString(EasyNode node)
          Format a nice, multi-line, indented, representation of the given XML fragment.
static String toString(EasyNode node, boolean includeXMLDecl)
          Format a nice, multi-line, indented, representation of the given XML fragment.
static String toString(Source node)
          Format a nice, multi-line, indented, representation of the given XML fragment.
static String toString(Source node, boolean includeXMLDecl)
          Format a nice, multi-line, indented, representation of the given XML fragment.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLWriter

public XMLWriter()
Method Detail

debug

public static void debug(EasyNode node)
Prints the node, in XML format, to Trace.debug()


debug

public static void debug(EasyNode node,
                         boolean includeXMLDecl)
Prints the node, in XML format, to Trace.debug()


debug

public static void debug(Source node)
Prints the node, in XML format, to Trace.debug()


debug

public static void debug(Source node,
                         boolean includeXMLDecl)
Prints the node, in XML format, to Trace.debug()


toString

public static String toString(EasyNode node)
Format a nice, multi-line, indented, representation of the given XML fragment.

Parameters:
node - Base node to format.

toString

public static String toString(EasyNode node,
                              boolean includeXMLDecl)
Format a nice, multi-line, indented, representation of the given XML fragment.

Parameters:
node - Base node to format.

toString

public static String toString(Source node)
Format a nice, multi-line, indented, representation of the given XML fragment.

Parameters:
node - Base node to format.

toString

public static String toString(Source node,
                              boolean includeXMLDecl)
Format a nice, multi-line, indented, representation of the given XML fragment.

Parameters:
node - Base node to format.
includeXMLDecl - true to include XML declaration, false to suppress it (useful for generating a fragment of XML to insert within a larger document.)