org.apache.empire.xml
Class XMLWriter

java.lang.Object
  extended by org.apache.empire.commons.ErrorObject
      extended by org.apache.empire.xml.XMLWriter
All Implemented Interfaces:
ErrorInfo

public class XMLWriter
extends ErrorObject

This class prints out a XML-DOM-Tree to an output stream.


Constructor Summary
XMLWriter(java.io.OutputStream outStream)
          Constructor
XMLWriter(java.io.OutputStream outStream, java.lang.String charsetEncoding)
          Creates a XML Writer object.
XMLWriter(java.io.Writer writer, java.lang.String charsetEncoding)
          Creates a XML Writer object.
 
Method Summary
static void debug(org.w3c.dom.Document doc)
          Prints out the DOM-Tree on System.out for debugging purposes.
static void debugToFile(org.w3c.dom.Document doc, java.lang.String filename)
          Prints out the DOM-Tree to a file for debugging purposes.
static java.lang.String normalize(java.lang.String s, boolean canonical)
           
 void print(org.w3c.dom.Document doc)
          Prints the specified document.
 void print(org.w3c.dom.Document doc, java.lang.String styleSheet)
          Prints the specified document.
 int print(org.w3c.dom.Node node, int level)
          Prints the specified node recursively
static void saveAsFile(org.w3c.dom.Document doc, java.lang.String filename)
          Prints out the DOM-Tree.
static void setXmlWriterDebugPath(java.lang.String path)
           
 
Methods inherited from class org.apache.empire.commons.ErrorObject
clearError, getErrorMessage, getErrorParams, getErrorSource, getErrorType, getMessage, hasError, isExceptionsEnabled, setExceptionsEnabled
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLWriter

public XMLWriter(java.io.Writer writer,
                 java.lang.String charsetEncoding)
Creates a XML Writer object.

Parameters:
writer - a writer to the output stream
charsetEncoding - encoding type (i.e. utf-8)

XMLWriter

public XMLWriter(java.io.OutputStream outStream,
                 java.lang.String charsetEncoding)
          throws java.io.UnsupportedEncodingException
Creates a XML Writer object.

Parameters:
outStream - the output stream
Throws:
java.io.UnsupportedEncodingException

XMLWriter

public XMLWriter(java.io.OutputStream outStream)
Constructor

Parameters:
outStream - the output stream
Method Detail

debug

public static void debug(org.w3c.dom.Document doc)
Prints out the DOM-Tree on System.out for debugging purposes.

Parameters:
doc - The XML-Document to print

debugToFile

public static void debugToFile(org.w3c.dom.Document doc,
                               java.lang.String filename)
Prints out the DOM-Tree to a file for debugging purposes. The file will be truncated if it exists or created if if does not exist.

Parameters:
doc - The XML-Document to print
filename - The name of the file to write the XML-Document to

saveAsFile

public static void saveAsFile(org.w3c.dom.Document doc,
                              java.lang.String filename)
Prints out the DOM-Tree. The file will be truncated if it exists or created if if does not exist.

Parameters:
doc - The XML-Document to print
filename - The name of the file to write the XML-Document to

setXmlWriterDebugPath

public static void setXmlWriterDebugPath(java.lang.String path)

print

public int print(org.w3c.dom.Node node,
                 int level)
Prints the specified node recursively

Parameters:
node - the current node to print
level - the nesting level used for indenting the output
Returns:
the node type of this node

print

public void print(org.w3c.dom.Document doc)
Prints the specified document.

Parameters:
doc - the XML-DOM-Document to print

print

public void print(org.w3c.dom.Document doc,
                  java.lang.String styleSheet)
Prints the specified document.

Parameters:
doc - the XML-DOM-Document to print
styleSheet - the XML-DOM-Document to print

normalize

public static java.lang.String normalize(java.lang.String s,
                                         boolean canonical)