Package de.pdark.decentxml
Class XMLWriter
- java.lang.Object
-
- java.io.Writer
-
- de.pdark.decentxml.XMLWriter
-
- All Implemented Interfaces:
java.io.Closeable,java.io.Flushable,java.lang.Appendable,java.lang.AutoCloseable
public class XMLWriter extends java.io.Writer
-
-
Constructor Summary
Constructors Constructor Description XMLWriter(java.io.Writer writer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidflush()java.lang.StringgetIndent()booleanhasSingleTextChild(Element e)voidindent()booleanisCompact(Element e)booleanisPadCompact()If this is true, the writer makes sure that there is a single space before "/>"voidnl()voidsetIndent(java.lang.String indent)voidsetPadCompact(boolean padCompact)voidwrite(char[] cbuf, int off, int len)voidwrite(Element e)Write an element with all attributes and childrenvoidwrite(Node node, java.lang.String s)If you want to see every node written to the underlying writer, this is the place.voidwriteAttributes(Element e)voidwriteAttributeValue(Node node, java.lang.String value, char quoteChar)voidwriteBeginElement(Element e)Write the start tag of an element including the attributes.voidwriteChildNodes(NodeWithChildren node)Write all children of a nodevoidwriteEndElement(Element e)Write the end tag of an element
-
-
-
Field Detail
-
writer
private final java.io.Writer writer
-
current
protected Node current
-
indent
private java.lang.String indent
-
level
private int level
-
padCompact
private boolean padCompact
-
-
Method Detail
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein classjava.io.Writer- Throws:
java.io.IOException
-
flush
public void flush() throws java.io.IOException- Specified by:
flushin interfacejava.io.Flushable- Specified by:
flushin classjava.io.Writer- Throws:
java.io.IOException
-
write
public void write(char[] cbuf, int off, int len) throws java.io.IOException- Specified by:
writein classjava.io.Writer- Throws:
java.io.IOException
-
write
public void write(Node node, java.lang.String s) throws java.io.IOException
If you want to see every node written to the underlying writer, this is the place.- Parameters:
node-s-- Throws:
java.io.IOException
-
writeAttributeValue
public void writeAttributeValue(Node node, java.lang.String value, char quoteChar) throws java.io.IOException
- Throws:
java.io.IOException
-
writeChildNodes
public void writeChildNodes(NodeWithChildren node) throws java.io.IOException
Write all children of a node- Throws:
java.io.IOException
-
write
public void write(Element e) throws java.io.IOException
Write an element with all attributes and children- Throws:
java.io.IOException
-
writeEndElement
public void writeEndElement(Element e) throws java.io.IOException
Write the end tag of an element- Throws:
java.io.IOException
-
writeBeginElement
public void writeBeginElement(Element e) throws java.io.IOException
Write the start tag of an element including the attributes.- Throws:
java.io.IOException
-
isCompact
public boolean isCompact(Element e)
-
hasSingleTextChild
public boolean hasSingleTextChild(Element e)
-
indent
public void indent() throws java.io.IOException- Throws:
java.io.IOException
-
nl
public void nl() throws java.io.IOException- Throws:
java.io.IOException
-
writeAttributes
public void writeAttributes(Element e) throws java.io.IOException
- Throws:
java.io.IOException
-
setIndent
public void setIndent(java.lang.String indent)
-
getIndent
public java.lang.String getIndent()
-
setPadCompact
public void setPadCompact(boolean padCompact)
-
isPadCompact
public boolean isPadCompact()
If this is true, the writer makes sure that there is a single space before "/>"
-
-