FileDocCategorySizeDatePackage
DocWriteJDOM.javaAPI DocExample894Wed Nov 21 18:08:16 GMT 2001None

DocWriteJDOM

public class DocWriteJDOM extends Object
Make up and write an XML document, using JDOM
author
Ian Darwin, ian@darwinsys.com
version
$Id: DocWriteJDOM.java,v 1.2 2001/11/21 23:08:17 ian Exp $

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(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 DocumentmakeDoc()
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;