com.generationjava.io.xml
Class FormattingXmlWriter

java.lang.Object
  |
  +--com.generationjava.io.xml.DelegatingXmlWriter
        |
        +--com.generationjava.io.xml.FormattingXmlWriter
All Implemented Interfaces:
XmlWriter

public class FormattingXmlWriter
extends DelegatingXmlWriter


Constructor Summary
FormattingXmlWriter(XmlWriter writer)
           
 
Method Summary
protected  java.lang.String format(java.lang.Object unknown)
           
 FormattingXmlWriter setDateFormat(java.text.DateFormat format)
          When a java.util.Date object is written, it will use this to format it.
 FormattingXmlWriter setNumberFormat(java.text.NumberFormat format)
          When a Number object is written, it will use this to format it.
 XmlWriter writeAttribute(java.lang.String name, java.lang.Object value)
          Write an attribute out for the current entity.
 XmlWriter writeEntityWithText(java.lang.String name, java.lang.Object text)
          A helper method.
 XmlWriter writeText(java.lang.Object text)
          Output body text.
 
Methods inherited from class com.generationjava.io.xml.DelegatingXmlWriter
close, endEntity, getWriter, writeCData, writeComment, writeEmptyEntity, writeEntity, writeXmlVersion, writeXmlVersion, writeXmlVersion
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FormattingXmlWriter

public FormattingXmlWriter(XmlWriter writer)
                    throws java.io.IOException
Method Detail

setNumberFormat

public FormattingXmlWriter setNumberFormat(java.text.NumberFormat format)
When a Number object is written, it will use this to format it. If the argument is null then it uses .toString.


setDateFormat

public FormattingXmlWriter setDateFormat(java.text.DateFormat format)
When a java.util.Date object is written, it will use this to format it. If the argument is null then it uses .toString.


writeEntityWithText

public XmlWriter writeEntityWithText(java.lang.String name,
                                     java.lang.Object text)
                              throws java.io.IOException
Description copied from class: DelegatingXmlWriter
A helper method. It writes out an entity which contains only text.

Specified by:
writeEntityWithText in interface XmlWriter
Overrides:
writeEntityWithText in class DelegatingXmlWriter
Parameters:
name - String name of tag
text - String of text to go inside the tag
java.io.IOException

writeText

public XmlWriter writeText(java.lang.Object text)
                    throws java.io.IOException
Description copied from class: DelegatingXmlWriter
Output body text. Any xml characters are escaped.

Specified by:
writeText in interface XmlWriter
Overrides:
writeText in class DelegatingXmlWriter
java.io.IOException

writeAttribute

public XmlWriter writeAttribute(java.lang.String name,
                                java.lang.Object value)
                         throws java.io.IOException
Description copied from class: DelegatingXmlWriter
Write an attribute out for the current entity. Any xml characters in the value are escaped. Currently it does not actually throw the exception, but the api is set that way for future changes.

Specified by:
writeAttribute in interface XmlWriter
Overrides:
writeAttribute in class DelegatingXmlWriter
java.io.IOException

format

protected java.lang.String format(java.lang.Object unknown)


Copyright © 2000-2003 GenerationJava. All Rights Reserved.