public class XmlWriter extends XmlWriterSupport
CLOSE, CLOSE_TAG_DECREASE, INDENT_ONLY, OPEN, OPEN_TAG_INCREASE
Constructor | Description |
---|---|
XmlWriter(java.io.Writer writer) |
Creates a new XML writer for the specified character stream.
|
XmlWriter(java.io.Writer writer,
java.lang.String indentString) |
Creates a new XML writer for the specified character stream.
|
XmlWriter(java.io.Writer writer,
TagDescription tagDescription) |
Default Constructor.
|
XmlWriter(java.io.Writer writer,
TagDescription tagDescription,
java.lang.String indentString) |
Creates a new XMLWriter instance.
|
XmlWriter(java.io.Writer writer,
TagDescription tagDescription,
java.lang.String indentString,
java.lang.String lineSeparator) |
Creates a new XMLWriter instance.
|
Modifier and Type | Method | Description |
---|---|---|
void |
close() |
Closes the underlying character stream.
|
void |
flush() |
Flushs the underlying writer.
|
void |
writeCloseTag() |
Writes a closing XML tag.
|
void |
writeComment(java.lang.String comment) |
Writes a comment into the generated xml file.
|
void |
writeNewLine() |
Writes a linebreak to the writer.
|
void |
writeStream(java.io.Reader reader) |
Copies the given reader to the character stream.
|
void |
writeTag(java.lang.String namespace,
java.lang.String name,
boolean close) |
Writes an opening XML tag that has no attributes.
|
void |
writeTag(java.lang.String namespace,
java.lang.String name,
java.lang.String attributeName,
java.lang.String attributeValue,
boolean close) |
Writes an opening XML tag with an attribute/value pair.
|
void |
writeTag(java.lang.String namespace,
java.lang.String name,
AttributeList attributes,
boolean close) |
Writes an opening XML tag along with a list of attribute/value pairs.
|
void |
writeText(java.lang.String text) |
Writes some text to the character stream.
|
void |
writeTextNormalized(java.lang.String s,
boolean transformNewLine) |
Writes the given text into the stream using a streaming xml-normalization method.
|
void |
writeXmlDeclaration(java.lang.String encoding) |
Writes the XML declaration that usually appears at the top of every XML
file.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addImpliedNamespace, copyNamespaces, getAdditionalIndent, getCurrentIndentLevel, getLineSeparator, getNamespaces, getTagDescription, indent, indentForClose, isAlwaysAddNamespace, isAssumeDefaultNamespace, isHtmlCompatiblityMode, isLineEmpty, isNamespaceDefined, isNamespacePrefixDefined, isWriteFinalLinebreak, normalize, normalizeLocal, setAdditionalIndent, setAlwaysAddNamespace, setAssumeDefaultNamespace, setHtmlCompatiblityMode, setLineEmpty, setWriteFinalLinebreak, writeCloseTag, writeComment, writeNewLine, writeTag, writeTag, writeTag, writeTextNormalized
public XmlWriter(java.io.Writer writer)
writer
- the character stream.public XmlWriter(java.io.Writer writer, TagDescription tagDescription)
writer
- the character stream.tagDescription
- the tags that are safe for line breaks.public XmlWriter(java.io.Writer writer, java.lang.String indentString)
writer
- the character stream.indentString
- the string used for indentation (should contain white
space, for example four spaces).public XmlWriter(java.io.Writer writer, TagDescription tagDescription, java.lang.String indentString)
writer
- the character stream.tagDescription
- the tags that are safe for line breaks.indentString
- the indent string.public XmlWriter(java.io.Writer writer, TagDescription tagDescription, java.lang.String indentString, java.lang.String lineSeparator)
writer
- the character stream.tagDescription
- the tags that are safe for line breaks.indentString
- the indent string.lineSeparator
- the line separator to be used.public void writeXmlDeclaration(java.lang.String encoding) throws java.io.IOException
encoding
- the encoding that should be declared (this has to match the
encoding of the writer, or funny things may happen when
parsing the xml file later).java.io.IOException
- if there is a problem writing to the character
stream.public void writeTag(java.lang.String namespace, java.lang.String name, boolean close) throws java.io.IOException
namespace
- the namespace URI for the elementname
- the tag name.close
- a flag that controls whether or not the tag is closed
immediately.java.io.IOException
- if there is an I/O problem.public void writeCloseTag() throws java.io.IOException
java.io.IOException
- if there is an I/O problem.public void writeTag(java.lang.String namespace, java.lang.String name, java.lang.String attributeName, java.lang.String attributeValue, boolean close) throws java.io.IOException
namespace
- the namespace URI for the elementname
- the tag name.attributeName
- the attribute name.attributeValue
- the attribute value.close
- controls whether the tag is closed.java.io.IOException
- if there is an I/O problem.public void writeTag(java.lang.String namespace, java.lang.String name, AttributeList attributes, boolean close) throws java.io.IOException
namespace
- the namespace URI for the elementname
- the tag name.attributes
- the attributes.close
- controls whether the tag is closed.java.io.IOException
- if there is an I/O problem.public void writeText(java.lang.String text) throws java.io.IOException
text
- the text.java.io.IOException
- if there is a problem writing to the character stream.public void writeTextNormalized(java.lang.String s, boolean transformNewLine) throws java.io.IOException
s
- the string to be written.transformNewLine
- whether to encode newlines using character-entities.java.io.IOException
- if an IO error occured.public void writeStream(java.io.Reader reader) throws java.io.IOException
reader
- the reader providing the text.java.io.IOException
- if there is a problem writing to the character stream.public void close() throws java.io.IOException
java.io.IOException
- if there is a problem closing the character stream.public void writeComment(java.lang.String comment) throws java.io.IOException
comment
- the comment textjava.io.IOException
- if there is a problem writing to the character stream.public void writeNewLine() throws java.io.IOException
java.io.IOException
- if there is a problem writing to the character stream.public void flush() throws java.io.IOException
java.io.IOException
- if something goes wrong.