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 void
close()
void
flush()
java.lang.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(java.lang.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, java.lang.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, java.lang.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
-
-
Method Detail
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Specified by:
close
in classjava.io.Writer
- Throws:
java.io.IOException
-
flush
public void flush() throws java.io.IOException
- Specified by:
flush
in interfacejava.io.Flushable
- Specified by:
flush
in classjava.io.Writer
- Throws:
java.io.IOException
-
write
public void write(char[] cbuf, int off, int len) throws java.io.IOException
- Specified by:
write
in 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 "/>"
-
-