| java.lang.Object org.dbunit.util.xml.XmlWriter
Constructor Summary | |
public | XmlWriter(Writer writer) Create an XmlWriter on top of an existing java.io.Writer. | public | XmlWriter(Writer writer, String encoding) Create an XmlWriter on top of an existing java.io.Writer. |
XmlWriter | public XmlWriter(Writer writer)(Code) | | Create an XmlWriter on top of an existing java.io.Writer.
|
XmlWriter | public XmlWriter(Writer writer, String encoding)(Code) | | Create an XmlWriter on top of an existing java.io.Writer.
|
close | public void close() throws IOException(Code) | | Close this writer. It does not close the underlying
writer, but does throw an exception if there are
as yet unclosed tags.
|
enablePrettyPrint | public void enablePrettyPrint(boolean enable)(Code) | | Turn pretty printing on or off.
Pretty printing is enabled by default, but it can be turned off
to generate more compact XML.
Parameters: enable - true to enable, false to disable pretty printing. |
endElement | public XmlWriter endElement() throws IOException(Code) | | End the current element. This will throw an exception
if it is called when there is not a currently open
element.
|
setIndent | public void setIndent(String indent)(Code) | | Specify the string to prepend to a line for each level of indent.
It is 2 spaces (" ") by default. Some may prefer a single tab ("\t")
or a different number of spaces. Specifying an empty string will turn
off indentation when pretty printing.
Parameters: indent - representing one level of indentation while pretty printing. |
setNewline | public void setNewline(String newline)(Code) | | Specify the string used to terminate each line when pretty printing.
It is a single newline ("\n") by default. Users who need to read
generated XML documents in Windows editors like Notepad may wish to
set this to a carriage return/newline sequence ("\r\n"). Specifying
an empty string will turn off generation of line breaks when pretty
printing.
Parameters: newline - representing the newline sequence when pretty printing. |
setWriter | final public void setWriter(Writer writer, String encoding)(Code) | | Resets the handler to write a new text document.
Parameters: writer - XML text is written to this writer. Parameters: encoding - if non-null, and an XML declaration is written,this is the name that will be used for the character encoding. exception: IllegalStateException - if the currentdocument hasn't yet ended (with XmlWriter.endDocument) |
writeAttribute | public XmlWriter writeAttribute(String attr, String value) throws IOException(Code) | | Write an attribute out for the current element.
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: attr - name of attribute. Parameters: value - value of attribute. |
writeCData | public XmlWriter writeCData(String cdata) throws IOException(Code) | | Write out a chunk of CDATA. This helper method surrounds the
passed in data with the CDATA tag.
Parameters: cdata - of CDATA text. |
writeComment | public XmlWriter writeComment(String comment) throws IOException(Code) | | Write out a chunk of comment. This helper method surrounds the
passed in data with the xml comment tag.
Parameters: comment - of text to comment. |
writeElement | public XmlWriter writeElement(String name) throws IOException(Code) | | Begin to write out an element. Unlike the helper tags, this tag
will need to be ended with the endElement method.
Parameters: name - String name of tag |
writeElementWithText | public XmlWriter writeElementWithText(String name, String text) throws IOException(Code) | | A helper method. It writes out an element which contains only text.
Parameters: name - String name of tag Parameters: text - String of text to go inside the tag |
writeEmptyElement | public XmlWriter writeEmptyElement(String name) throws IOException(Code) | | A helper method. It writes out empty entities.
Parameters: name - String name of tag |
|
|