IMSEVimse 1.0
Draft

se.kth.cid.xml
Class XmlPrinter

java.lang.Object
  |
  +--se.kth.cid.xml.XmlPrinter

public class XmlPrinter
extends Object

This class prints XML files on an OutputStream.

Version:
$Revision: 1.1.1.1 $
Author:
Mikael Nilsson

Field Summary
static String[][] encodableStrings
           
 
Constructor Summary
XmlPrinter()
          Constructs an XmlPrinter
 
Method Summary
 void addComment(String comment)
          Adds a comment to all printed documents.
 void print(XmlDocument doc, OutputStream os, String encoding)
          Prints an XmlDocument on an OutputStream.
 void print(XmlDocument doc, Writer w, String encoding)
          Prints an XmlDocument on a Writer.
 void setStandalone(boolean nstandalone)
          Sets the standalone status of printed documents.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

encodableStrings

public static final String[][] encodableStrings
Constructor Detail

XmlPrinter

public XmlPrinter()
Constructs an XmlPrinter
Method Detail

setStandalone

public void setStandalone(boolean nstandalone)
Sets the standalone status of printed documents.
Parameters:
nstandalone - whether printed documents should be standalone.

addComment

public void addComment(String comment)
                throws XmlPrinterException
Adds a comment to all printed documents.
Parameters:
comment - the comment string. May not contain "-->".
Throws:
XmlPrinterException - if the comment includes "-->".

print

public void print(XmlDocument doc,
                  OutputStream os,
                  String encoding)
           throws UnsupportedEncodingException
Prints an XmlDocument on an OutputStream. The encodings are specified as in XML. Supported are ISO-8859-[1-9] and UTF-8.
Parameters:
doc - the document to print.
os - the stream to print to.
nencoding - the encoding to use. If null, the default UTF-8 is used.
Throws:
UnsupportedEncodingException - if the exception is not supported (by XML or by Java).

print

public void print(XmlDocument doc,
                  Writer w,
                  String encoding)
Prints an XmlDocument on a Writer.
Parameters:
doc - the document to print.
w - the writer to print to.
nencoding - the encoding to use. Note: characters are not converted. This is only used in the XML declaration. If null, the default UTF-8 is used.

IMSEVimse 1.0
Draft

Centre for user-oriented IT -design