|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.io.Writer java.io.FilterWriter org.apache.commons.xmlio.out.XMLWriter org.apache.commons.xmlio.out.XMLStringWriter
public class XMLStringWriter
This is a convenience class for writing XML to a string. As
no IOExceptions will occur this class catches them for you
doing nothing. Call toString()
to finally get your string.
As constructor for XMLWriter
already needs writer call
create()
to get your objects instead of consructor.
Field Summary |
---|
Fields inherited from class org.apache.commons.xmlio.out.XMLWriter |
---|
depth, indent, NEWLINE, nlAfterEmptyTag, nlAfterEndTag, nlAfterStartTag, NO_NEWLINE, prettyPrintMode, tabWidth, xmlDeclWritten |
Fields inherited from class java.io.FilterWriter |
---|
out |
Fields inherited from class java.io.Writer |
---|
lock |
Method Summary | |
---|---|
static XMLStringWriter |
create()
Creates a new XMLStringWriter objects. |
String |
toString()
Gets the string representation of your written XML. |
void |
writeCData(String cData)
Writes character data with encoding. |
void |
writeComment(String comment)
Writes comment encoded as comment. |
void |
writeElementWithCData(String startTag,
String cData,
String endTag)
Writes a full element consisting of a start tag, character data and an end tag. |
void |
writeElementWithPCData(String startTag,
String pcData,
String endTag)
Writes a full element consisting of a start tag, character data and an end tag. |
void |
writeEmptyElement(String emptyTag)
Writes an empty element. |
void |
writeEmptyElement(String emptyTag,
boolean nl)
Writes an empty element. |
void |
writeEndTag(String endTag)
Writes an end tag. |
void |
writeEndTag(String endTag,
boolean nl)
Writes an end tag. |
void |
writeNl()
Writes a single newline. |
void |
writePCData(String pcData)
Writes character data without encoding. |
void |
writePI(String target,
String data)
Writes a processing instruction. |
void |
writeProlog(String prolog)
Writes prolog data like doctype delcaration and DTD parts followed by a newline. |
void |
writeStartTag(String startTag)
Writes a start tag. |
void |
writeStartTag(String startTag,
boolean nl)
Writes a start tag. |
void |
writeXMLDeclaration()
Writes XML declaration. |
Methods inherited from class java.io.FilterWriter |
---|
close, flush, write, write, write |
Methods inherited from class java.io.Writer |
---|
append, append, append, append, append, append, write, write |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public static XMLStringWriter create()
XMLStringWriter
objects.
public String toString()
toString
in class Object
public void writeXMLDeclaration()
XMLWriter
<?xml version="1.0"?>
XMLWriter.writeProlog(String)
.xmlDeclWritten
to
true
.
writeXMLDeclaration
in class XMLWriter
public void writeProlog(String prolog)
XMLWriter
FilterWriter.write(int)
methods.
writeProlog
in class XMLWriter
public void writeNl()
XMLWriter
writeNl
in class XMLWriter
public void writeComment(String comment)
XMLWriter
comment
encoded as comment.
writeComment
in class XMLWriter
public void writePI(String target, String data)
XMLWriter
writePI
in class XMLWriter
public void writeStartTag(String startTag, boolean nl)
XMLWriter
writeStartTag
in class XMLWriter
startTag
- the complete start tag, e.g. <start>
nl
- decides whether there should be a newline after the tagpublic void writeStartTag(String startTag)
XMLWriter
writeStartTag
in class XMLWriter
startTag
- the complete start tag, e.g. <start>
XMLWriter.setNlAfterStartTag(boolean)
public void writeEndTag(String endTag, boolean nl)
XMLWriter
writeEndTag
in class XMLWriter
endTag
- the complete end tag, e.g. </end>
nl
- decides whether there should be a newline after the tagpublic void writeEndTag(String endTag)
XMLWriter
writeEndTag
in class XMLWriter
endTag
- the complete end tag, e.g. </end>
XMLWriter.setNlAfterEndTag(boolean)
public void writeEmptyElement(String emptyTag, boolean nl)
XMLWriter
writeEmptyElement
in class XMLWriter
emptyTag
- the complete tag for an empty element, e.g. <empty/>
nl
- decides whether there should be a newline after the tagpublic void writeEmptyElement(String emptyTag)
XMLWriter
writeEmptyElement
in class XMLWriter
emptyTag
- the complete tag for an empty element, e.g. <start/>
XMLWriter.setNlAfterEmptyTag(boolean)
public void writeCData(String cData)
XMLWriter
writeCData
in class XMLWriter
cData
- the character data to writepublic void writePCData(String pcData)
XMLWriter
writePCData
in class XMLWriter
pcData
- the parseable character data to writepublic void writeElementWithCData(String startTag, String cData, String endTag)
XMLWriter
writeElementWithCData
in class XMLWriter
startTag
- the complete start tag, e.g. <element>
cData
- the character data to writeendTag
- the complete end tag, e.g. </element>
public void writeElementWithPCData(String startTag, String pcData, String endTag)
XMLWriter
writeElementWithPCData
in class XMLWriter
startTag
- the complete start tag, e.g. <element>
pcData
- the parseable character data to writeendTag
- the complete end tag, e.g. </element>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |