FileDocCategorySizeDatePackage
DocWriteJDOM.javaAPI DocExample927Sun Feb 08 21:34:10 GMT 2004None

DocWriteJDOM

public class DocWriteJDOM extends Object
Make up and write an XML document, using JDOM
author
Ian Darwin, http://www.darwinsys.com/
version
$Id: DocWriteJDOM.java,v 1.4 2004/02/09 03:34:10 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 org.jdom.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;