DocWriteJDOMpublic class DocWriteJDOM extends Object Make up and write an XML document, using JDOM |
Methods Summary |
---|
public static void | main(java.lang.String[] av)
DocWriteJDOM dw = new DocWriteJDOM();
Document doc = dw.makeDoc();
// Create an output formatter, and have it write the doc.
new XMLOutputter().output(doc, System.out);
| protected Document | makeDoc()Generate the XML document
Document doc = new Document(new Element("Poem"));
doc.getRootElement().
addContent(new Element("Stanza").
addContent(new Element("Line").
setText("Once, upon a midnight dreary")).
addContent(new Element("Line").
setText("While I pondered, weak and weary")));
return doc;
|
|