Joda System API

org.joda.property.xml
Class XMLOutputter

java.lang.Object
  |
  +--org.joda.property.xml.XMLOutputter

public class XMLOutputter
extends java.lang.Object

Output an object as XML to a stream/writer. Each instance of this object can be re-used, as the output methods create an internal helper to actually output the XML.

Author:
Stephen Colebourne

Nested Class Summary
static class XMLOutputter.Handler
          Inner class to manage the SAX events.
 
Constructor Summary
XMLOutputter()
          Constructor for XMLOutputter, using the default meta data.
XMLOutputter(XMLMetaData metaData)
          Constructor for XMLOutputter
 
Method Summary
protected  org.xml.sax.ContentHandler createHandler(java.io.Writer writer, boolean compressed)
          Create the SAX handler to handle the events.
 XMLMetaData getMetaData()
          Gets the metadata for XML output.
 java.lang.String output(java.lang.Object bean)
          Output a Bean as a string.
 java.lang.String output(java.lang.Object bean, java.lang.String rootName)
          Output a Bean as a string.
 void output(java.lang.Object bean, java.lang.String rootName, java.io.OutputStream out)
          Output a bean to the specified output stream.
 void output(java.lang.Object bean, java.lang.String rootName, java.io.Writer out)
          Output a bean to the specified Writer.
 void setMetaData(XMLMetaData metaData)
          Sets the metaData for XML output.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLOutputter

public XMLOutputter()
Constructor for XMLOutputter, using the default meta data.


XMLOutputter

public XMLOutputter(XMLMetaData metaData)
Constructor for XMLOutputter

Method Detail

output

public void output(java.lang.Object bean,
                   java.lang.String rootName,
                   java.io.Writer out)
            throws java.lang.Exception
Output a bean to the specified Writer.

Parameters:
bean - the bean to output
rootName - the name of the root element
out - output stream to write to
java.lang.Exception

output

public void output(java.lang.Object bean,
                   java.lang.String rootName,
                   java.io.OutputStream out)
            throws java.lang.Exception
Output a bean to the specified output stream.

Parameters:
bean - the bean to output
rootName - the name of the root element
out - output stream to write to
java.lang.Exception

output

public java.lang.String output(java.lang.Object bean)
                        throws java.lang.Exception
Output a Bean as a string.

Parameters:
bean - the bean to output
java.lang.Exception

output

public java.lang.String output(java.lang.Object bean,
                               java.lang.String rootName)
                        throws java.lang.Exception
Output a Bean as a string.

Parameters:
bean - the bean to output
rootName - the name of the root element
java.lang.Exception

getMetaData

public XMLMetaData getMetaData()
Gets the metadata for XML output.

Returns:
the metadata

setMetaData

public void setMetaData(XMLMetaData metaData)
Sets the metaData for XML output.

Parameters:
metaData - the metaData to use

createHandler

protected org.xml.sax.ContentHandler createHandler(java.io.Writer writer,
                                                   boolean compressed)
                                            throws java.lang.Exception
Create the SAX handler to handle the events. Override this method to change the content handler.

Parameters:
writer - the writer to write to
compressed - whether to compress the output
java.lang.Exception

Joda System API

Copyright © 2001-2003 Stephen Colebourne. All Rights Reserved.