Package org.jfree.xml.writer
Class XMLWriter
java.lang.Object
org.jfree.xml.writer.XMLWriterSupport
org.jfree.xml.writer.XMLWriter
A class for writing XML to a character stream.
-
Field Summary
FieldsFields inherited from class org.jfree.xml.writer.XMLWriterSupport
CLOSE, CLOSE_TAG_DECREASE, INDENT_ONLY, OPEN, OPEN_TAG_INCREASE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes the underlying character stream.void
writeCloseTag
(String tag) Writes a closing XML tag.void
Writes an opening XML tag that has no attributes.void
Writes an opening XML tag with an attribute/value pair.void
writeTag
(String name, Properties attributes, boolean close) Deprecated.use the attribute list instead ...void
writeTag
(String name, AttributeList attributes, boolean close) Writes an opening XML tag along with a list of attribute/value pairs.void
Writes some text to the character stream.void
Writes the XML declaration that usually appears at the top of every XML file.Methods inherited from class org.jfree.xml.writer.XMLWriterSupport
allowLineBreak, decreaseIndent, endBlock, getIndentLevel, getLineSeparator, getSafeTags, increaseIndent, indent, normalize, startBlock, writeCloseTag, writeTag, writeTag, writeTag, writeTag
-
Field Details
-
writer
The character stream.
-
-
Constructor Details
-
XMLWriter
Creates a new XML writer for the specified character stream. By default, four spaces are used for indentation.- Parameters:
writer
- the character stream.
-
XMLWriter
Creates a new XML writer for the specified character stream.- Parameters:
writer
- the character stream.indentString
- the string used for indentation (should contain white space, for example four spaces).
-
-
Method Details
-
writeXmlDeclaration
Writes the XML declaration that usually appears at the top of every XML file.- Throws:
IOException
- if there is a problem writing to the character stream.
-
writeTag
Writes an opening XML tag that has no attributes.- Parameters:
name
- the tag name.close
- a flag that controls whether or not the tag is closed immediately.- Throws:
IOException
- if there is an I/O problem.
-
writeCloseTag
Writes a closing XML tag.- Parameters:
tag
- the tag name.- Throws:
IOException
- if there is an I/O problem.
-
writeTag
public void writeTag(String name, String attributeName, String attributeValue, boolean close) throws IOException Writes an opening XML tag with an attribute/value pair.- Parameters:
name
- the tag name.attributeName
- the attribute name.attributeValue
- the attribute value.close
- controls whether the tag is closed.- Throws:
IOException
- if there is an I/O problem.
-
writeTag
Writes an opening XML tag along with a list of attribute/value pairs.- Parameters:
name
- the tag name.attributes
- the attributes.close
- controls whether the tag is closed.- Throws:
IOException
- if there is an I/O problem.
-
writeTag
Deprecated.use the attribute list instead ...Writes an opening XML tag along with a list of attribute/value pairs.- Parameters:
name
- the tag name.attributes
- the attributes.close
- controls whether the tag is closed.- Throws:
IOException
- if there is an I/O problem.
-
writeText
Writes some text to the character stream.- Parameters:
text
- the text.- Throws:
IOException
- if there is a problem writing to the character stream.
-
close
Closes the underlying character stream.- Throws:
IOException
- if there is a problem closing the character stream.
-