marytts.util.dom
Class MaryNormalisedWriter

java.lang.Object
  extended by marytts.util.dom.MaryNormalisedWriter

public class MaryNormalisedWriter
extends java.lang.Object

A wrapper class for output of XML DOM trees in a Mary normalised way: One tag or text node per line, no indentation. This is only needed during the transition phase to "real" XML modules.

Author:
Marc Schröder

Constructor Summary
MaryNormalisedWriter()
          Default constructor.
 
Method Summary
static void main(java.lang.String[] args)
          The simplest possible command line interface to the MaryNormalisedWriter.
 void output(org.w3c.dom.Node input)
          Output a DOM node to stdout.
 void output(org.w3c.dom.Node input, java.io.OutputStream destination)
          Output a DOM node to a specified destination
 void output(javax.xml.transform.Source input)
          Output any Source to stdout.
 void output(javax.xml.transform.Source input, javax.xml.transform.Result destination)
          The actual output to stdout.
static void startup()
          Start up the static parts, and compile the normalise-maryxml XSLT stylesheet which can then be used by multiple threads.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MaryNormalisedWriter

public MaryNormalisedWriter()
                     throws javax.xml.transform.TransformerFactoryConfigurationError,
                            javax.xml.transform.TransformerConfigurationException
Default constructor. Calls startup() if it has not been called before.

Throws:
javax.xml.transform.TransformerFactoryConfigurationError
javax.xml.transform.TransformerConfigurationException
See Also:
startup().
Method Detail

startup

public static void startup()
                    throws javax.xml.transform.TransformerFactoryConfigurationError,
                           javax.xml.transform.TransformerConfigurationException
Start up the static parts, and compile the normalise-maryxml XSLT stylesheet which can then be used by multiple threads.

Throws:
javax.xml.transform.TransformerFactoryConfigurationError - if the TransformerFactory cannot be instanciated.
java.io.FileNotFoundException - if the stylesheet file cannot be found.
javax.xml.transform.TransformerConfigurationException - if the templates stylesheet cannot be generated.

output

public void output(javax.xml.transform.Source input,
                   javax.xml.transform.Result destination)
            throws javax.xml.transform.TransformerException
The actual output to stdout.

Parameters:
input - a DOMSource, a SAXSource or a StreamSource.
Throws:
javax.xml.transform.TransformerException - if the transformation cannot be performed.
See Also:
Transformer

output

public void output(javax.xml.transform.Source input)
            throws javax.xml.transform.TransformerException
Output any Source to stdout.

Throws:
javax.xml.transform.TransformerException

output

public void output(org.w3c.dom.Node input)
            throws javax.xml.transform.TransformerException
Output a DOM node to stdout.

Throws:
javax.xml.transform.TransformerException
See Also:
output(Source)

output

public void output(org.w3c.dom.Node input,
                   java.io.OutputStream destination)
            throws javax.xml.transform.TransformerException
Output a DOM node to a specified destination

Throws:
javax.xml.transform.TransformerException

main

public static void main(java.lang.String[] args)
                 throws java.lang.Throwable
The simplest possible command line interface to the MaryNormalisedWriter. Reads a "real" XML document from stdin, and outputs it in the MaryNormalised form to stdout.

Throws:
java.lang.Throwable