public class DOMToXML extends Object
addIndent(org.w3c.dom.Node)
method can be used to add additional whitespace-nodes as seperators to
element nodes. This is particularily useful if you want a easy-to-read
output.| Modifier and Type | Field and Description |
|---|---|
static int |
DEFINDENT
The default indentation (2).
|
private static Transformer |
serializer
The transformer instance.
|
private static TransformerFactory |
transform
The transformer factory to transform a dom to a stream.
|
| Constructor and Description |
|---|
DOMToXML() |
| Modifier and Type | Method and Description |
|---|---|
static Node |
addIndent(Node source)
Adds whitespce nodes as seperators between element nodes.
|
static Node |
addIndent(Node source,
int indent)
Adds whitespce nodes as seperators between element nodes.
|
private static void |
addWhitespaceNode(Document anchor,
Element squeeze,
int curindent,
int indent)
Recursively add whitespace nodes to elements found.
|
static Document |
fillDefaults(Document raw,
String dtd) |
static void |
main(String[] arg) |
static void |
setOutputProperties(Properties oprop)
Defines properties for the output overruling the default values.
|
static void |
setOutputProperty(String key,
String value)
Defines properties for the output overruling the default values.
|
static void |
transform(Node doc,
File out)
Transforms a DOM node into an xml-file.
|
static void |
transform(Node doc,
OutputStream out)
Transforms a DOM node into an xml-output stream.
|
static void |
transform(Node doc,
String out)
Transforms a DOM node into an xml-URL.
|
static void |
transform(Node doc,
Writer out)
Transforms a DOM node into an xml-writer.
|
public static final int DEFINDENT
private static TransformerFactory transform
private static Transformer serializer
public static Document fillDefaults(Document raw, String dtd) throws TransformerException
TransformerExceptionpublic static void setOutputProperties(Properties oprop)
public static void setOutputProperty(String key, String value)
public static void transform(Node doc, OutputStream out) throws TransformerException
TransformerExceptionpublic static void transform(Node doc, File out) throws TransformerException
TransformerExceptionpublic static void transform(Node doc, String out) throws TransformerException
out - Must be a String that conforms to the URI syntax.TransformerExceptionpublic static void transform(Node doc, Writer out) throws TransformerException
TransformerExceptionpublic static Node addIndent(Node source)
public static Node addIndent(Node source, int indent)
private static void addWhitespaceNode(Document anchor, Element squeeze, int curindent, int indent)
public static void main(String[] arg) throws TransformerException
TransformerException