Enhydra 3.1b2 API

org.enhydra.xml.io
Class DOMFormatter

java.lang.Object
  |
  +--org.enhydra.xml.io.DOMFormatter

public class DOMFormatter
extends java.lang.Object

Class for formatting DOMs into a documents. The class handles XML and HTML pages, looking up the approriate formatting routines based on the document type. It has an associated OutputOptions object that controls the formatting. Instances are reusable and multithreaded.


Constructor Summary
DOMFormatter()
          Construct a new XML formatter with default output options.
DOMFormatter(OutputOptions outputOptions)
          Construct a new XML formatter with the specified output options.
 
Method Summary
static OutputOptions getDefaultOutputOptions(Document doc)
          Get the default OutputOptions for a document.
static Formatter getFormatter(Node node, OutputOptions outputOptions, boolean forPreFormatting)
           
 OutputOptions getOutputOptions()
          Get the output options.
 void setOutputOptions(OutputOptions outputOptions)
          Set the output options.
 byte[] toBytes(Node node)
          Format a document or any node and its children into a byte array using the current encoding.
 java.lang.String toString(Node node)
          Format a document or any node and its children into a string.
 void write(Node node, java.io.File out)
          Output a document or any node and its children to a File.
 void write(Node node, java.io.OutputStream out)
          Output a document or any node and its children to a OutputStream.
 void write(Node node, java.io.Writer writer)
          Output a document or any node and its children to a Writer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DOMFormatter

public DOMFormatter(OutputOptions outputOptions)
Construct a new XML formatter with the specified output options.
Parameters:
outputOptions - The OutputOptions to use for formatters obtained from this object.

DOMFormatter

public DOMFormatter()
Construct a new XML formatter with default output options.
Method Detail

getOutputOptions

public OutputOptions getOutputOptions()
Get the output options.

setOutputOptions

public void setOutputOptions(OutputOptions outputOptions)
Set the output options.

getDefaultOutputOptions

public static OutputOptions getDefaultOutputOptions(Document doc)
Get the default OutputOptions for a document.

getFormatter

public static Formatter getFormatter(Node node,
                                     OutputOptions outputOptions,
                                     boolean forPreFormatting)

toString

public java.lang.String toString(Node node)
Format a document or any node and its children into a string.

toBytes

public byte[] toBytes(Node node)
               throws java.io.IOException
Format a document or any node and its children into a byte array using the current encoding.

write

public void write(Node node,
                  java.io.Writer writer)
           throws java.io.IOException
Output a document or any node and its children to a Writer.

write

public void write(Node node,
                  java.io.OutputStream out)
           throws java.io.IOException
Output a document or any node and its children to a OutputStream.

write

public void write(Node node,
                  java.io.File out)
           throws java.io.IOException
Output a document or any node and its children to a File.

Enhydra 3.1b2 API