//////////////////////////////////////////////////////////////////////////////
// 
//               Copyright 2010, Starting Block Technologies
//                        www.startingblocktech.com
//
//////////////////////////////////////////////////////////////////////////////

package com.startingblocktech.tcases.util;

import java.io.OutputStream;
import java.io.Writer;
  
/**
 * Supports creation of an XML document stream.
 *
 * @version $Revision$, $Date$
 */
public class XmlWriter extends IndentedWriter
  {
  /**
   * Creates a new XmlWriter object.
   */
  public XmlWriter( OutputStream output)
    {
    super( output);
    }

  /**
   * Creates a new XmlWriter object.
   */
  public XmlWriter( Writer writer)
    {
    super( writer);
    }

  /**
   * Begins an element start tag.
   */
  public void writeTagStart( String tag)
    {
    startLine();
    print( "<");
    print( tag);
    }

  /**
   * Completes an element start tag.
   */
  public void writeTagEnd()
    {
    print( "/>");
    println();
    }

  /**
   * Writes an element start tag.
   */
  public void writeElementStart( String tag)
    {
    startLine();
    print( "<");
    print( tag);
    print( ">");
    println();
    }

  /**
   * Writes an element end tag.
   */
  public void writeElementEnd( String tag)
    {
    startLine();
    print( "</");
    print( tag);
    print( ">");
    println();
    }

  /**
   * Writes the end of an empty element.
   */
  public void writeEmptyElementEnd()
    {
    print( "/>");
    println();
    }

  /**
   * Writes an attribute definition.
   */
  public void writeAttribute( String name, String value)
    {
    print( " ");
    print( name);
    print( "=\"");
    print( value);
    print( "\"");
    }
  }

@@ -743,32 +743,437 @@
 writer);%0A    %7D%0A%0A
+  /**%0A   * Writes the standard XML document declaration%0A   */%0A  public void writeDeclaration( String encoding)%0A    %7B%0A    print( %22%3C?xml version=%5C%221.0%5C%22%22);%0A    if( encoding != null)%0A      %7B%0A      writeAttribute( %22encoding%22, encoding);%0A      %7D%0A    println( %22?%3E%22);%0A    %7D%0A%0A  /**%0A   * Writes the standard XML document declaration%0A   */%0A  public void writeDeclaration()%0A    %7B%0A    writeDeclaration( null);%0A    %7D%0A%0A
   /**%0A   * Begin
@@ -1188,32 +1188,32 @@
 ment start tag.%0A
-
    */%0A  public v
@@ -1382,32 +1382,32 @@
 eTagEnd()%0A    %7B%0A
+
     print( %22/%3E%22)
@@ -1394,33 +1394,32 @@
   %7B%0A    print( %22
-/
 %3E%22);%0A    println

Add writeDeclaration()