November 2002
Intermediate to advanced
1120 pages
21h 2m
English
Once you've created a document, you're likely to want to serialize it to a network socket, a file, a string, or some other stream. JDOM's org.jdom.output.XMLOutputter class does this in a standard way. You can create an XMLOutputter object with a no-args constructor and then write a document onto an OutputStream with its output() method. For example, the following code fragment writes the Document object named doc onto System.out:
XMLOutputter outputter = new XMLOutputter();
try {
outputter.output(doc, System.out);
}
catch (IOException e) {
System.err.println(e);
}
Although you also can output a document onto a java.io.Writer, it's recommended that you use an OutputStream because it's generally not possible to ...
Read now
Unlock full access