UTF-X, Unit Testing Framework - Xslt

utfx.util
Class DOMWriter

java.lang.Object
  extended by utfx.util.DOMWriter

public class DOMWriter
extends java.lang.Object

DOMWriter.

Copyright © 2004 - University of Southern Queensland.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License v2 as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

$Source: /cvs/utf-x/framework/src/java/utfx/util/DOMWriter.java,v $

Version:
$Revidion:$ $Date: 2005/03/09 03:53:19 $ $Name: release_0_0_8_alpha $
Author:
Jacek Radajewski, Oliver Lucido (Lulu)

Field Summary
private static java.lang.String ENCODING
          Encoding of the printWriter we are using
private  boolean escapeQuoteCharacters
          True to escape single and double quote characters
private  java.io.PrintWriter out
          The print writer to output the DOM document
private  boolean stripWhiteSpace
          True to strip white space surrounding elements
 
Constructor Summary
DOMWriter(java.io.OutputStream os)
          Creates a DOMWriter for pretty printing the DOM.
DOMWriter(java.io.OutputStream os, boolean strip)
          Creates a DOMWriter for pretty printing the DOM.
DOMWriter(java.io.OutputStream os, boolean stripWhiteSpace, boolean escapeQuoteCharacters)
          Creates a DOMWriter for pretty printing the DOM.
 
Method Summary
protected  java.lang.String normalize(java.lang.String s, boolean escapeQuoteCharacters)
          Converts characters to their appropriate XML entity reference.
 void print(org.w3c.dom.Node node)
          Prints any node in the DOM including the Document Element and any Doctype elements, recursively calls it self to print child elements.
protected  org.w3c.dom.Attr[] sortAttributes(org.w3c.dom.NamedNodeMap attrs)
          Sorts element attributes into alphabetical order I dont know why this is necessary.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ENCODING

private static java.lang.String ENCODING
Encoding of the printWriter we are using


out

private java.io.PrintWriter out
The print writer to output the DOM document


stripWhiteSpace

private boolean stripWhiteSpace
True to strip white space surrounding elements


escapeQuoteCharacters

private boolean escapeQuoteCharacters
True to escape single and double quote characters

Constructor Detail

DOMWriter

public DOMWriter(java.io.OutputStream os)
          throws java.lang.Exception
Creates a DOMWriter for pretty printing the DOM.

Parameters:
os - The output stream to write the XML to
Throws:
java.lang.Exception

DOMWriter

public DOMWriter(java.io.OutputStream os,
                 boolean strip)
          throws java.lang.Exception
Creates a DOMWriter for pretty printing the DOM.

Parameters:
os - The output stream to write the XML to
strip - True to strip the white space surrounding elements
Throws:
java.lang.Exception

DOMWriter

public DOMWriter(java.io.OutputStream os,
                 boolean stripWhiteSpace,
                 boolean escapeQuoteCharacters)
          throws java.lang.Exception
Creates a DOMWriter for pretty printing the DOM.

Parameters:
os - The output stream to write the XML to
stripWhiteSpace - True to strip the white space surrounding elements
escapeQuoteCharacters - True to escape single and double quote characters
Throws:
java.lang.Exception
Method Detail

print

public void print(org.w3c.dom.Node node)
Prints any node in the DOM including the Document Element and any Doctype elements, recursively calls it self to print child elements.

Parameters:
node - the node to start printing from (usually the root).

normalize

protected java.lang.String normalize(java.lang.String s,
                                     boolean escapeQuoteCharacters)
Converts characters to their appropriate XML entity reference. The characters <, >, and & will be escaped within text nodes and attribute values. The characters " and ' will be escaped within text nodes only if escapeQuoteCharacters is set to true, otherwise they will be output as is. The characters " and ' will be escaped within attribute values, regardless of the value of escapeQuoteCharacters.

Parameters:
s - the string to normalize
escapeQuoteCharacters - whether to escape quote characters

sortAttributes

protected org.w3c.dom.Attr[] sortAttributes(org.w3c.dom.NamedNodeMap attrs)
Sorts element attributes into alphabetical order I dont know why this is necessary.


UTF-X, Unit Testing Framework - Xslt