net.sf.vex
Class DocumentWriter

java.lang.Object
  |
  +--net.sf.vex.DocumentWriter

public class DocumentWriter
extends java.lang.Object

Writes a document to an output stream, using a stylesheet to provide formatting hints.

Documents are currently saved UTF-8 encoding, with no encoding specified in the XML declaration.


Constructor Summary
DocumentWriter(StyleSheet styleSheet)
          Class constructor.
 
Method Summary
static java.lang.String escape(java.lang.String s)
          Escapes special XML characters.
 java.lang.String getIndent()
          Returns the indent string.
 StyleSheet getStyleSheet()
          Returns the style sheet used to provide formatting hints to the writer.
 int getWrapColumn()
          Returns the column at which text should be wrapped.
 void setIndent(java.lang.String indent)
          Sets the value of the indent string.
 void setWrapColumn(int wrapColumn)
          Sets the value of the wrap column.
 void writeDocument(Document doc, java.io.OutputStream os)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DocumentWriter

public DocumentWriter(StyleSheet styleSheet)
Class constructor.

Parameters:
styleSheet - StyleSheet used to provide hints as to whether elements are block- or inline-formatted.
Method Detail

escape

public static java.lang.String escape(java.lang.String s)
Escapes special XML characters. Changes '<', '>', and '&' to '<', '>' and '&', respectively.

Parameters:
s - the string to be escaped.
Returns:
the escaped string

getIndent

public java.lang.String getIndent()
Returns the indent string. By default this is two spaces.


getStyleSheet

public StyleSheet getStyleSheet()
Returns the style sheet used to provide formatting hints to the writer.


getWrapColumn

public int getWrapColumn()
Returns the column at which text should be wrapped. By default this is 72.


setIndent

public void setIndent(java.lang.String indent)
Sets the value of the indent string.

Parameters:
indent - new value for the indent string.

setWrapColumn

public void setWrapColumn(int wrapColumn)
Sets the value of the wrap column.

Parameters:
wrapColumn - new value for the wrap column.

writeDocument

public void writeDocument(Document doc,
                          java.io.OutputStream os)
                   throws java.io.IOException
java.io.IOException