Package de.pdark.decentxml
Class XMLWriter
- java.lang.Object
-
- java.io.Writer
-
- de.pdark.decentxml.XMLWriter
-
- All Implemented Interfaces:
Closeable,Flushable,Appendable,AutoCloseable
public class XMLWriter extends Writer
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidflush()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(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, String s)If you want to see every node written to the underlying writer, this is the place.voidwriteAttributes(Element e)voidwriteAttributeValue(Node node, 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
-
current
protected Node current
-
-
Constructor Detail
-
XMLWriter
public XMLWriter(Writer writer)
-
-
Method Detail
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classWriter- Throws:
IOException
-
flush
public void flush() throws IOException- Specified by:
flushin interfaceFlushable- Specified by:
flushin classWriter- Throws:
IOException
-
write
public void write(char[] cbuf, int off, int len) throws IOException- Specified by:
writein classWriter- Throws:
IOException
-
write
public void write(Node node, String s) throws IOException
If you want to see every node written to the underlying writer, this is the place.- Parameters:
node-s-- Throws:
IOException
-
writeAttributeValue
public void writeAttributeValue(Node node, String value, char quoteChar) throws IOException
- Throws:
IOException
-
writeChildNodes
public void writeChildNodes(NodeWithChildren node) throws IOException
Write all children of a node- Throws:
IOException
-
write
public void write(Element e) throws IOException
Write an element with all attributes and children- Throws:
IOException
-
writeEndElement
public void writeEndElement(Element e) throws IOException
Write the end tag of an element- Throws:
IOException
-
writeBeginElement
public void writeBeginElement(Element e) throws IOException
Write the start tag of an element including the attributes.- Throws:
IOException
-
isCompact
public boolean isCompact(Element e)
-
hasSingleTextChild
public boolean hasSingleTextChild(Element e)
-
indent
public void indent() throws IOException- Throws:
IOException
-
nl
public void nl() throws IOException- Throws:
IOException
-
writeAttributes
public void writeAttributes(Element e) throws IOException
- Throws:
IOException
-
setIndent
public void setIndent(String indent)
-
getIndent
public 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 "/>"
-
-