|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.dbunit.util.xml.XmlWriter
Makes writing XML much much easier. Improved from article
Constructor Summary | |
XmlWriter(java.io.Writer writer)
Create an XmlWriter on top of an existing java.io.Writer. |
|
XmlWriter(java.io.Writer writer,
java.lang.String encoding)
Create an XmlWriter on top of an existing java.io.Writer. |
Method Summary | |
void |
close()
Close this writer. |
void |
enablePrettyPrint(boolean enable)
Turn pretty printing on or off. |
XmlWriter |
endElement()
End the current element. |
static void |
main(java.lang.String[] args)
|
void |
setIndent(java.lang.String indent)
Specify the string to prepend to a line for each level of indent. |
void |
setNewline(java.lang.String newline)
Specify the string used to terminate each line when pretty printing. |
void |
setWriter(java.io.Writer writer,
java.lang.String encoding)
Resets the handler to write a new text document. |
static void |
test1()
|
static void |
test2()
|
XmlWriter |
writeAttribute(java.lang.String attr,
java.lang.String value)
Write an attribute out for the current element. |
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 |
writeDeclaration()
|
XmlWriter |
writeDoctype(java.lang.String systemId,
java.lang.String publicId)
|
XmlWriter |
writeElement(java.lang.String name)
Begin to write out an element. |
XmlWriter |
writeElementWithText(java.lang.String name,
java.lang.String text)
A helper method. |
XmlWriter |
writeEmptyElement(java.lang.String name)
A helper method. |
XmlWriter |
writeText(java.lang.String text)
Output body text. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public XmlWriter(java.io.Writer writer)
public XmlWriter(java.io.Writer writer, java.lang.String encoding)
Method Detail |
public void enablePrettyPrint(boolean enable)
enable
- true to enable, false to disable pretty printing.public void setIndent(java.lang.String indent)
indent
- representing one level of indentation while pretty printing.public void setNewline(java.lang.String newline)
newline
- representing the newline sequence when pretty printing.public XmlWriter writeElementWithText(java.lang.String name, java.lang.String text) throws java.io.IOException
name
- String name of tagtext
- String of text to go inside the tag
java.io.IOException
public XmlWriter writeEmptyElement(java.lang.String name) throws java.io.IOException
name
- String name of tag
java.io.IOException
public XmlWriter writeElement(java.lang.String name) throws java.io.IOException
name
- String name of tag
java.io.IOException
public XmlWriter writeAttribute(java.lang.String attr, java.lang.String value) throws java.io.IOException
attr
- name of attribute.value
- value of attribute.
java.io.IOException
public XmlWriter endElement() throws java.io.IOException
java.io.IOException
public void close() throws java.io.IOException
java.io.IOException
public XmlWriter writeText(java.lang.String text) throws java.io.IOException
java.io.IOException
public XmlWriter writeCData(java.lang.String cdata) throws java.io.IOException
cdata
- of CDATA text.
java.io.IOException
public XmlWriter writeComment(java.lang.String comment) throws java.io.IOException
comment
- of text to comment.
java.io.IOException
public static void main(java.lang.String[] args) throws java.io.IOException
java.io.IOException
public static void test1() throws java.io.IOException
java.io.IOException
public static void test2() throws java.io.IOException
java.io.IOException
public final void setWriter(java.io.Writer writer, java.lang.String encoding)
writer
- XML text is written to this writer.encoding
- if non-null, and an XML declaration is written,
this is the name that will be used for the character encoding.
java.lang.IllegalStateException
- if the current
document hasn't yet ended (with #endDocument
)public XmlWriter writeDeclaration() throws java.io.IOException
java.io.IOException
public XmlWriter writeDoctype(java.lang.String systemId, java.lang.String publicId) throws java.io.IOException
java.io.IOException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |