com.generationjava.io.xml
Class EmptyElementXmlWriter

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

public class EmptyElementXmlWriter
extends DelegatingXmlWriter


Field Summary
static java.lang.Object EMPTY_MODE
          Considers null and an empty string to be 'empty'.
static java.lang.Object IGNORE_EMPTY_MODE
          Ignores empty concepts and prints out all attributes/entities.
static java.lang.Object NULL_EMPTY_MODE
          Only considers null to be empty, so empty strings are outputted.
 
Constructor Summary
EmptyElementXmlWriter(XmlWriter xmlwriter)
          Create an EmptyElementXmlWriter on top of an existing java.io.Writer.
 
Method Summary
 XmlWriter setEmptyMode(java.lang.Object mode)
          The emptiness strategy to use.
 XmlWriter writeAttribute(java.lang.String attr, java.lang.Object value)
          Write an attribute out for the current entity.
 XmlWriter writeCData(java.lang.String cdata)
          Write out a chunk of CDATA.
 XmlWriter writeComment(java.lang.String comment)
          Write out a chunk of comment.
 XmlWriter writeEntity(java.lang.String name)
          Begin to write out an entity.
 XmlWriter writeText(java.lang.Object text)
          Output body text.
 
Methods inherited from class com.generationjava.io.xml.DelegatingXmlWriter
close, endEntity, getWriter, writeEmptyEntity, writeEntityWithText, writeXmlVersion, writeXmlVersion, writeXmlVersion
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IGNORE_EMPTY_MODE

public static java.lang.Object IGNORE_EMPTY_MODE
Ignores empty concepts and prints out all attributes/entities. So it will print out foo="null"


NULL_EMPTY_MODE

public static java.lang.Object NULL_EMPTY_MODE
Only considers null to be empty, so empty strings are outputted.


EMPTY_MODE

public static java.lang.Object EMPTY_MODE
Considers null and an empty string to be 'empty'. If somethign is empty, it will not output them. This is the default mode.

Constructor Detail

EmptyElementXmlWriter

public EmptyElementXmlWriter(XmlWriter xmlwriter)
Create an EmptyElementXmlWriter on top of an existing java.io.Writer.

Method Detail

setEmptyMode

public XmlWriter setEmptyMode(java.lang.Object mode)
The emptiness strategy to use. Emptiness is when it decides that an element should be ignored.


writeEntity

public XmlWriter writeEntity(java.lang.String name)
                      throws java.io.IOException
Description copied from class: DelegatingXmlWriter
Begin to write out an entity. Unlike the helper tags, this tag will need to be ended with the endEntity method.

Specified by:
writeEntity in interface XmlWriter
Overrides:
writeEntity in class DelegatingXmlWriter
Parameters:
name - String name of tag
java.io.IOException

writeAttribute

public XmlWriter writeAttribute(java.lang.String attr,
                                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

writeText

public XmlWriter writeText(java.lang.Object text)
                    throws java.io.IOException
Output body text. Any xml characters are escaped.

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

writeCData

public XmlWriter writeCData(java.lang.String cdata)
                     throws java.io.IOException
Write out a chunk of CDATA. This helper method surrounds the passed in data with the CDATA tag.

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

writeComment

public XmlWriter writeComment(java.lang.String comment)
                       throws java.io.IOException
Write out a chunk of comment. This helper method surrounds the passed in data with the xml comment tag.

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


Copyright © 2000-2003 GenerationJava. All Rights Reserved.