|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.Writer
java.io.BufferedWriter
com.lightdev.lib.xml.io.XmlWriter
public class XmlWriter
Basic XML writer to subclass from
This class provides basic methods for writing XML tags and attributes. It is meant for subclassing from in the way that a subclass transfroms content to XmlTag objects which it passes to its superclass (this class) for writing.
XmlTag| Field Summary | |
|---|---|
static char |
ATTR_NAME_START
character to indicate the start of an attribute |
static char |
ATTR_SEPARATOR
character to separate an attribute name from an attribute value |
static char |
ATTR_VALUE_BORDER
character to indicate the start or end of an attribute value |
static char |
END_TAG_INDICATOR
character to indicate an end tag |
static char |
INDENT_CHAR
the character to use to indent |
static int |
INDENT_INCREMENT
indent increment per level |
static char |
TAG_END
character to indicate a tag end |
static char |
TAG_START
character to indicate a tag start |
static char |
XML_TAG_INDICATOR
|
| Constructor Summary | |
|---|---|
XmlWriter(Writer out,
boolean maskSpecialChars)
construct an XmlWriter |
|
| Method Summary | |
|---|---|
void |
indent(int len)
write indent characters for the given number of character positions |
void |
writeEndTag(XmlTag tag)
write an end tag |
void |
writeStartTag(XmlTag tag,
boolean asEndTag)
write a start tag for given XML tag |
void |
writeTag(XmlTag tag)
write a given XmlTag |
boolean |
writeTag(XmlTag tag,
boolean hasChildren)
write a given XmlTag |
| Methods inherited from class java.io.BufferedWriter |
|---|
close, flush, newLine, write, write, write |
| Methods inherited from class java.io.Writer |
|---|
append, append, append, write, write |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int INDENT_INCREMENT
public static final char INDENT_CHAR
public static final char TAG_START
public static final char TAG_END
public static final char END_TAG_INDICATOR
public static final char ATTR_NAME_START
public static final char ATTR_SEPARATOR
public static final char ATTR_VALUE_BORDER
public static final char XML_TAG_INDICATOR
| Constructor Detail |
|---|
public XmlWriter(Writer out,
boolean maskSpecialChars)
XmlWriter
out - Writer the writer to write to| Method Detail |
|---|
public boolean writeTag(XmlTag tag,
boolean hasChildren)
throws IOException
XmlTag
tag - XmlTag the tag to writehasChildren - boolean true, if the tag has children
IOException
public void writeTag(XmlTag tag)
throws IOException
tag - XmlTag the tag to write
IOException
public void writeStartTag(XmlTag tag,
boolean asEndTag)
throws IOException
tag - XmlTag the XML tag to write a start tag forasEndTag - true, if the start tag is end tag too (all in one tag)
IOException - if something goes wrong during a write activity
public void writeEndTag(XmlTag tag)
throws IOException
tag - XmlTag the tag to write an end tag foronNewLine - boolean true, if the end tag is to be written on a new line
IOException - if something went wrong during write
public void indent(int len)
throws IOException
len - int the number of character positions to indent
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||