com.generationjava.io.xml
Class XmlEncXmlWriter

java.lang.Object
  extended by com.generationjava.io.xml.AbstractXmlWriter
      extended by com.generationjava.io.xml.XmlEncXmlWriter
All Implemented Interfaces:
XmlWriter

public class XmlEncXmlWriter
extends AbstractXmlWriter

An XmlWriter implementation, meaning it actually does output, that sits on top of the znerd.ord XmlEnc library. This should allow for faster speed with some additional features, though the design of this API blocks these features from the user.


Constructor Summary
XmlEncXmlWriter(Writer writer)
           
XmlEncXmlWriter(Writer writer, String encoding)
           
 
Method Summary
 void close()
          Close this.xmlenc.
 XmlWriter endEntity()
          End the current entity.
 Writer getWriter()
          Obtain the Writer that is at the lowest level of this XmlWriter chain
 void setDefaultNamespace(String namespace)
          The default namespace.
 XmlWriter writeAttribute(String attr, Object value)
          Write an attribute out for the current entity.
 XmlWriter writeCData(String cdata)
          Write out a chunk of CDATA.
 XmlWriter writeComment(String comment)
          Write out a chunk of comment.
 XmlWriter writeEntity(String name)
          Begin to write out an entity.
 XmlWriter writeText(Object text)
          Output body text.
 XmlWriter writeXmlVersion(String version, String encoding, String standalone)
          Output the version, encoding and standalone nature of an xml file.
 
Methods inherited from class com.generationjava.io.xml.AbstractXmlWriter
writeEmptyEntity, writeEntityWithText, writeXmlVersion, writeXmlVersion
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlEncXmlWriter

public XmlEncXmlWriter(Writer writer)

XmlEncXmlWriter

public XmlEncXmlWriter(Writer writer,
                       String encoding)
Method Detail

setDefaultNamespace

public void setDefaultNamespace(String namespace)
The default namespace. Once this is turned on, any new entities will have this namespace, regardless of scope.

Parameters:
String - nname of the namespace

writeXmlVersion

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

Throws:
IOException

writeEntity

public XmlWriter writeEntity(String name)
                      throws 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
Throws:
IOException

writeAttribute

public XmlWriter writeAttribute(String attr,
                                Object value)
                         throws 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.

Parameters:
String - name of attribute.
Object - value of attribute.
Throws:
IOException

endEntity

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

Throws:
IOException

close

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

Throws:
IOException

writeText

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

Throws:
IOException

writeCData

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

Parameters:
String - of CDATA text.
Throws:
IOException

writeComment

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

Parameters:
String - of text to comment.
Throws:
IOException

getWriter

public Writer getWriter()
Description copied from interface: XmlWriter
Obtain the Writer that is at the lowest level of this XmlWriter chain



Copyright © 2000-2007 OSJava. All Rights Reserved.