com.generationjava.io.xml
Interface XmlWriter

All Known Implementing Classes:
AbstractXmlWriter, DelegatingXmlWriter

public interface XmlWriter


Method Summary
 void close()
          Close this writer.
 XmlWriter endEntity()
          End the current entity.
 java.io.Writer getWriter()
          Obtain the Writer that is at the lowest level of this XmlWriter chain
 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 writeEmptyEntity(java.lang.String name)
          A helper method.
 XmlWriter writeEntity(java.lang.String name)
          Begin to write out an entity.
 XmlWriter writeEntityWithText(java.lang.String name, java.lang.Object text)
          A helper method.
 XmlWriter writeText(java.lang.Object text)
          Output body text.
 XmlWriter writeXmlVersion()
          Makes it easy to output the xml version if such a thing is desired.
 XmlWriter writeXmlVersion(java.lang.String version, java.lang.String encoding)
           
 XmlWriter writeXmlVersion(java.lang.String version, java.lang.String encoding, java.lang.String standalone)
          Output the version, encoding and standalone nature of an xml file.
 

Method Detail

writeXmlVersion

public XmlWriter writeXmlVersion()
                          throws java.io.IOException
Makes it easy to output the xml version if such a thing is desired. While it usually is desired, it is less surprising not to handle it.

java.io.IOException

writeXmlVersion

public XmlWriter writeXmlVersion(java.lang.String version,
                                 java.lang.String encoding)
                          throws java.io.IOException
java.io.IOException
See Also:
XmlWriter.writeXmlVersion(String, String, String)

writeXmlVersion

public XmlWriter writeXmlVersion(java.lang.String version,
                                 java.lang.String encoding,
                                 java.lang.String standalone)
                          throws java.io.IOException
Output the version, encoding and standalone nature of an xml file.

java.io.IOException

writeEntityWithText

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

Parameters:
name - String name of tag
text - String of text to go inside the tag
java.io.IOException

writeEmptyEntity

public XmlWriter writeEmptyEntity(java.lang.String name)
                           throws java.io.IOException
A helper method. It writes out empty entities.

Parameters:
name - String name of tag
java.io.IOException

writeEntity

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

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
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.

java.io.IOException

endEntity

public XmlWriter endEntity()
                    throws java.io.IOException
End the current entity. This will throw an exception if it is called when there is not a currently open entity.

java.io.IOException

close

public void close()
           throws java.io.IOException
Close this writer. It does not close the underlying writer, but does throw an exception if there are as yet unclosed tags.

java.io.IOException

writeText

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

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.

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.

java.io.IOException

getWriter

public java.io.Writer getWriter()
Obtain the Writer that is at the lowest level of this XmlWriter chain



Copyright © 2000-2003 GenerationJava. All Rights Reserved.