net.sf.jplist.output
Class XmlOutputter

java.lang.Object
  extended by net.sf.jplist.output.XmlOutputter

public class XmlOutputter
extends java.lang.Object

Builds an XML representation of a PList object. This outputter provides a way to work with ASCII PLists but interoperate with another application that needs XML.

Version:
$Revision: 1.1 $
Author:
Sujit Pal (spal@users.sourceforge.net)

Constructor Summary
XmlOutputter()
          Builds a new XmlOutputter object.
 
Method Summary
protected  java.io.Writer makeWriter(java.io.OutputStream ostream)
          Builds a PrintWriter object out of an OutputStream.
 void output(ArrayElement arrayElement, java.io.OutputStream ostream)
          Output the ArrayElement object to an OutputStream.
 void output(ArrayElement arrayElement, java.io.Writer writer)
          Output the ArrayElement object to a Writer.
 void output(DataElement dataElement, java.io.OutputStream ostream)
          Output the JPList DataElement object to an OutputStream.
 void output(DataElement dataElement, java.io.Writer writer)
          Output the DataElement object to a Writer.
 void output(DictionaryElement dictionaryElement, java.io.OutputStream ostream)
          Output the DictionaryElement object to an OutputStream.
 void output(DictionaryElement dictionaryElement, java.io.Writer writer)
          Output a DictionaryElement object to a Writer.
 void output(Document doc, java.io.OutputStream ostream)
          Output the JPList Document object to an OutputStream.
 void output(Document doc, java.io.Writer writer)
          Output the JPList Document object to a Writer.
 void output(StringElement stringElement, java.io.OutputStream ostream)
          Output the JPList StringElement object to an OutputStream.
 void output(StringElement stringElement, java.io.Writer writer)
          Output the StringElement object to a Writer.
 java.lang.String outputString(ArrayElement arrayElement)
          Output an ArrayElement object to a String.
 java.lang.String outputString(DataElement dataElement)
          Output a DataElement object to a String.
 java.lang.String outputString(DictionaryElement dictionaryElement)
          Output a DictionaryElement object to a String.
 java.lang.String outputString(Document doc)
          Output a JPList Document object as a String.
 java.lang.String outputString(IElement element)
          Routing function to format the various IElement implementations.
 java.lang.String outputString(StringElement stringElement)
          Output a StringElement object to a String.
 void setIndent(java.lang.String indent)
          Allows setting of the indent.
 void setLineSeparator(java.lang.String lineSeparator)
          Sets a line separator for the output.
 void setNewLines(boolean newline)
          Newlines will appear in the output if this is set to true.
 void setTrimAllWhite(boolean trimAllWhite)
          If set to true, all non-essential whitespace will be trimmed.
 java.lang.String toString()
          Returns a String representation of this XMLOutputter with its current settings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XmlOutputter

public XmlOutputter()
Builds a new XmlOutputter object.

Method Detail

setIndent

public void setIndent(java.lang.String indent)
Allows setting of the indent. The indent will be the actual string provided.

Parameters:
indent - the string to indent with.

setLineSeparator

public void setLineSeparator(java.lang.String lineSeparator)
Sets a line separator for the output. If not specified, the platform's default line separator will be used if setNewLines() is set to true.

Parameters:
lineSeparator - the string with which to separate lines.

setNewLines

public void setNewLines(boolean newline)
Newlines will appear in the output if this is set to true.

Parameters:
newline - true if output should have newlines for formatting.

setTrimAllWhite

public void setTrimAllWhite(boolean trimAllWhite)
If set to true, all non-essential whitespace will be trimmed.

Parameters:
trimAllWhite - true to trim non-essential whitespace.

output

public void output(Document doc,
                   java.io.OutputStream ostream)
            throws java.io.IOException
Output the JPList Document object to an OutputStream.

Parameters:
doc - the Document object.
ostream - the OutputStream.
Throws:
java.io.IOException - if there was a problem.

output

public void output(StringElement stringElement,
                   java.io.OutputStream ostream)
            throws java.io.IOException
Output the JPList StringElement object to an OutputStream.

Parameters:
stringElement - the StringElement to output.
ostream - the OutputStream
Throws:
java.io.IOException - if there was a problem.

output

public void output(DataElement dataElement,
                   java.io.OutputStream ostream)
            throws java.io.IOException
Output the JPList DataElement object to an OutputStream.

Parameters:
dataElement - the DataElement to output.
ostream - the OutputStream.
Throws:
java.io.IOException - if there was a problem.

output

public void output(ArrayElement arrayElement,
                   java.io.OutputStream ostream)
            throws java.io.IOException
Output the ArrayElement object to an OutputStream.

Parameters:
arrayElement - the ArrayElement object to output.
ostream - the OutputStream.
Throws:
java.io.IOException - if there was a problem.

output

public void output(DictionaryElement dictionaryElement,
                   java.io.OutputStream ostream)
            throws java.io.IOException
Output the DictionaryElement object to an OutputStream.

Parameters:
dictionaryElement - the DictionaryElement to output.
ostream - the OutputStream.
Throws:
java.io.IOException - if there was a problem.

output

public void output(Document doc,
                   java.io.Writer writer)
            throws java.io.IOException
Output the JPList Document object to a Writer.

Parameters:
doc - the Document object to output.
writer - the Writer object.
Throws:
java.io.IOException - if there was a problem.

output

public void output(StringElement stringElement,
                   java.io.Writer writer)
            throws java.io.IOException
Output the StringElement object to a Writer.

Parameters:
stringElement - the StringElement object to output.
writer - the Writer object.
Throws:
java.io.IOException - if there was a problem.

output

public void output(DataElement dataElement,
                   java.io.Writer writer)
            throws java.io.IOException
Output the DataElement object to a Writer.

Parameters:
dataElement - the DataElement object to output.
writer - the Writer object.
Throws:
java.io.IOException - if there was a problem.

output

public void output(ArrayElement arrayElement,
                   java.io.Writer writer)
            throws java.io.IOException
Output the ArrayElement object to a Writer.

Parameters:
arrayElement - the ArrayElement object to output.
writer - the Writer object.
Throws:
java.io.IOException - if there was a problem.

output

public void output(DictionaryElement dictionaryElement,
                   java.io.Writer writer)
            throws java.io.IOException
Output a DictionaryElement object to a Writer.

Parameters:
dictionaryElement - the DictionaryElement object to output.
writer - the Writer object.
Throws:
java.io.IOException - if there was a problem.

outputString

public java.lang.String outputString(Document doc)
Output a JPList Document object as a String.

Parameters:
doc - the JPList Document object.
Returns:
the XML string representation of the JPList.

outputString

public java.lang.String outputString(IElement element)
Routing function to format the various IElement implementations.

Parameters:
element - an IElement to output.
Returns:
the String representation of the IElement as a partial PList.

outputString

public java.lang.String outputString(StringElement stringElement)
Output a StringElement object to a String.

Parameters:
stringElement - the StringElement object to output.
Returns:
the StringElement as a partial XML PList.

outputString

public java.lang.String outputString(DataElement dataElement)
Output a DataElement object to a String.

Parameters:
dataElement - the DataElement object to output.
Returns:
the DataElement as a partial XML PList.

outputString

public java.lang.String outputString(ArrayElement arrayElement)
Output an ArrayElement object to a String.

Parameters:
arrayElement - the ArrayElement object to output.
Returns:
the ArrayElement as a partial XML PList.

outputString

public java.lang.String outputString(DictionaryElement dictionaryElement)
Output a DictionaryElement object to a String.

Parameters:
dictionaryElement - the DictionaryElement object to output.
Returns:
the DictionaryElement as a partial XML PList.

toString

public java.lang.String toString()
Returns a String representation of this XMLOutputter with its current settings.

Overrides:
toString in class java.lang.Object
Returns:
a String representation of the XMLOutputter object.

makeWriter

protected java.io.Writer makeWriter(java.io.OutputStream ostream)
Builds a PrintWriter object out of an OutputStream.

Parameters:
ostream - an OutputStream object.
Returns:
a Writer.