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 void
close()
void
flush()
String
getIndent()
boolean
hasSingleTextChild(Element e)
void
indent()
boolean
isCompact(Element e)
boolean
isPadCompact()
If this is true, the writer makes sure that there is a single space before "/>"void
nl()
void
setIndent(String indent)
void
setPadCompact(boolean padCompact)
void
write(char[] cbuf, int off, int len)
void
write(Element e)
Write an element with all attributes and childrenvoid
write(Node node, String s)
If you want to see every node written to the underlying writer, this is the place.void
writeAttributes(Element e)
void
writeAttributeValue(Node node, String value, char quoteChar)
void
writeBeginElement(Element e)
Write the start tag of an element including the attributes.void
writeChildNodes(NodeWithChildren node)
Write all children of a nodevoid
writeEndElement(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:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in classWriter
- Throws:
IOException
-
flush
public void flush() throws IOException
- Specified by:
flush
in interfaceFlushable
- Specified by:
flush
in classWriter
- Throws:
IOException
-
write
public void write(char[] cbuf, int off, int len) throws IOException
- Specified by:
write
in 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 "/>"
-
-