Document document = DocumentHelper.createDocument(); Element root = document.addElement(ROOT_ELEMENT_NAME);  Iterator<BugInstance> i = this.iterator();  while (i.hasNext()) { BugInstance bugInstance = i.next(); bugInstance.toElement(root); }
	public void writeXML(String fileName) throws IOException {		Document document = DocumentHelper.createDocument();		Element root = document.addElement(ROOT_ELEMENT_NAME);		Iterator<BugInstance> i = this.iterator();		while (i.hasNext()) {			BugInstance bugInstance = i.next();			bugInstance.toElement(root);		}		BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(fileName));		XMLWriter writer = new XMLWriter(out);		writer.write(document);	}