|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectxml.DOMToXML
public class DOMToXML
Converts a DOM-document into an XML-stream. Additionally,
but only useful for whitespce-stripped DOMs the 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.
| Field Summary | |
|---|---|
static int |
DEFINDENT
The default indentation (2). |
private static Properties |
output
Properties of the output. |
private static Transformer |
serializer
The transformer instance. |
private static TransformerFactory |
transform
The transformer factory to transform a dom to a stream. |
| Constructor Summary | |
|---|---|
DOMToXML()
|
|
| Method Summary | |
|---|---|
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int DEFINDENT
private static TransformerFactory transform
private static Transformer serializer
private static Properties output
| Constructor Detail |
|---|
public DOMToXML()
| Method Detail |
|---|
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
TransformerException
public static void transform(Node doc,
File out)
throws TransformerException
TransformerException
public static void transform(Node doc,
String out)
throws TransformerException
out - Must be a String that conforms to the URI syntax.
TransformerException
public 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
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||