org.exolab.jmscts.report
Class TransformerHelper

java.lang.Object
  |
  +--org.exolab.jmscts.report.TransformerHelper

public final class TransformerHelper
extends java.lang.Object

Helper class for performing XML transformations

Version:
$Revision: 1.5 $ $Date: 2004/02/02 03:50:24 $
Author:
Tim Anderson

Method Summary
static javax.xml.transform.Templates getStylesheet(java.io.File path)
          Loads a stylesheet
static void transform(java.io.File inputPath, java.io.File outputPath, java.io.File stylesheetPath)
          Transforms a file
static void transform(java.io.File inputPath, java.io.File outputPath, javax.xml.transform.Templates stylesheet, java.util.HashMap properties)
          Transforms a file
static void transformAllXDoc2HTML(java.io.File inputDir, java.io.File outputDir, java.io.File baseDir)
          Transforms all xdoc files in a directory to HTML
static void transformXDoc2HTML(java.io.File inputPath, java.io.File outputPath, java.io.File baseDir)
          Transforms a single xdoc file to HTML.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

transformXDoc2HTML

public static void transformXDoc2HTML(java.io.File inputPath,
                                      java.io.File outputPath,
                                      java.io.File baseDir)
                               throws java.io.IOException,
                                      javax.xml.transform.TransformerException
Transforms a single xdoc file to HTML. if the output path is a directory, the output file name will be the same name as the input path, with a .html extension.
Parameters:
inputPath - the path of the file to transform
outputPath - the file or directory to generate HTML
baseDir - the base directory path to locate resources
Throws:
java.io.IOException - for any I/O error
javax.xml.transform.TransformerException - if the stylesheet cannot be loaded or applied

transformAllXDoc2HTML

public static void transformAllXDoc2HTML(java.io.File inputDir,
                                         java.io.File outputDir,
                                         java.io.File baseDir)
                                  throws java.io.IOException,
                                         javax.xml.transform.TransformerException
Transforms all xdoc files in a directory to HTML
Parameters:
inputDir - the directory containing the xdocs
outputDir - the directory to generate HTML
baseDir - the base directory path to locate resources
Throws:
java.io.IOException - for any I/O error
javax.xml.transform.TransformerException - if the stylesheet cannot be loaded or applied

transform

public static void transform(java.io.File inputPath,
                             java.io.File outputPath,
                             java.io.File stylesheetPath)
                      throws java.io.IOException,
                             javax.xml.transform.TransformerException
Transforms a file
Parameters:
inputPath - the path of the file to transform
outputPath - the path to write the transformed file
stylesheetPath - the path to the stylesheet to perform the transformation
Throws:
java.io.IOException - for any I/O error
javax.xml.transform.TransformerException - if the stylesheet cannot be loaded or applied

transform

public static void transform(java.io.File inputPath,
                             java.io.File outputPath,
                             javax.xml.transform.Templates stylesheet,
                             java.util.HashMap properties)
                      throws java.io.IOException,
                             javax.xml.transform.TransformerException
Transforms a file
Parameters:
inputPath - the path of the file to transform
outputPath - the path to write the transformed file
stylesheet - the stylesheet to perform the transformation
properties - properties to pass to the transformation
Throws:
java.io.IOException - for any I/O error
javax.xml.transform.TransformerException - if the stylesheet cannot be loaded or applied

getStylesheet

public static javax.xml.transform.Templates getStylesheet(java.io.File path)
                                                   throws javax.xml.transform.TransformerException
Loads a stylesheet
Parameters:
path - the stylesheet path
Returns:
the stylesheet
Throws:
javax.xml.transform.TransformerException - if the stylesheet cannot be loaded


Copyright © 2001-2004 JMS CTS Team. All Rights Reserved.