net.sourceforge.jdbcexporter.formatter
Class XMLDelimiterFormatter

java.lang.Object
  extended bynet.sourceforge.jdbcexporter.formatter.XMLDelimiterFormatter
All Implemented Interfaces:
DelimiterFormatter

public class XMLDelimiterFormatter
extends java.lang.Object
implements DelimiterFormatter

The XMLDelimiterFormatter class implements the DelimiterFormatter interface to format column values into an XML document and transform the XML document with the given XSL.

Version:
0.6
Author:
Chris Nagy

Field Summary
protected  java.lang.String[] columnElementNames
          The list of names for the column elements.
protected  java.lang.String rowElementName
          The name of the element that encloses the row data.
protected  java.lang.String rowsElementName
          The root element name.
protected  java.io.StringWriter tmpWriter
          The temporary writer.
protected  java.io.Writer writer
          The output writer.
protected  java.lang.String xslString
          The XSL used to transform the XML.
 
Constructor Summary
XMLDelimiterFormatter()
           
 
Method Summary
 void finish()
          Finishs the writing of rows to the output source.
 java.lang.String formatValues(ColumnValue[] values)
          Creates a string representing the row of column values.
 void setColumnElements(java.lang.String names)
          Sets the list of names for the column elements.
 void setRowElement(java.lang.String name)
          Sets the name of the element that encloses the row data.
 void setRowsElement(java.lang.String name)
          Sets the root element name.
 void setWriter(java.io.Writer output)
          Sets the output source for the formatter.
 void setXSL(java.lang.String str)
          Set the XSL that will be used to transform the XML.
 void setXSLFile(java.lang.String filename)
          Set the xsl filename that will be used to transform the XML before writing to the file.
 void writeNextRow(java.lang.String row)
          Writes the next row to the output source.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

writer

protected java.io.Writer writer
The output writer.


xslString

protected java.lang.String xslString
The XSL used to transform the XML.


tmpWriter

protected java.io.StringWriter tmpWriter
The temporary writer.


rowsElementName

protected java.lang.String rowsElementName
The root element name.


rowElementName

protected java.lang.String rowElementName
The name of the element that encloses the row data.


columnElementNames

protected java.lang.String[] columnElementNames
The list of names for the column elements.

Constructor Detail

XMLDelimiterFormatter

public XMLDelimiterFormatter()
Method Detail

setRowsElement

public void setRowsElement(java.lang.String name)
Sets the root element name.

Parameters:
name - the element name
Since:
0.7

setRowElement

public void setRowElement(java.lang.String name)
Sets the name of the element that encloses the row data.

Parameters:
name - the element name
Since:
0.7

setColumnElements

public void setColumnElements(java.lang.String names)
Sets the list of names for the column elements.

Parameters:
names - a comma-separated list of element names. if the list of columns is longer then the last value in the list is used for the rest of columns.
Since:
0.7

setWriter

public void setWriter(java.io.Writer output)
Description copied from interface: DelimiterFormatter
Sets the output source for the formatter.

Specified by:
setWriter in interface DelimiterFormatter
Parameters:
output - the destination of the data
See Also:
DelimiterFormatter.setWriter(java.io.Writer)

formatValues

public java.lang.String formatValues(ColumnValue[] values)
Description copied from interface: DelimiterFormatter
Creates a string representing the row of column values.

Specified by:
formatValues in interface DelimiterFormatter
Parameters:
values - the column values
Returns:
the string
See Also:
DelimiterFormatter.formatValues(net.sourceforge.jdbcimporter.ColumnValue[])

writeNextRow

public void writeNextRow(java.lang.String row)
                  throws java.io.IOException
Description copied from interface: DelimiterFormatter
Writes the next row to the output source.

Specified by:
writeNextRow in interface DelimiterFormatter
Parameters:
row - the next row
Throws:
java.io.IOException - if an error occurs while writing the next row
See Also:
DelimiterFormatter.writeNextRow(java.lang.String)

finish

public void finish()
            throws java.io.IOException
Description copied from interface: DelimiterFormatter
Finishs the writing of rows to the output source.

Specified by:
finish in interface DelimiterFormatter
Throws:
java.io.IOException
See Also:
DelimiterFormatter.finish()

setXSLFile

public void setXSLFile(java.lang.String filename)
Set the xsl filename that will be used to transform the XML before writing to the file.

Parameters:
filename - the filename

setXSL

public void setXSL(java.lang.String str)
Set the XSL that will be used to transform the XML.

Parameters:
str - the xsl