Joined: Thu Oct 13, 2005 10:25 am Posts: 19 Location: Germany, Hamburg
|
Document doc = DocumentHelper.createDocument();
Element root = doc.addElement(rootName);
Collection result = new LinkedHashSet(getSimpleList(
EntityMode.DOM4J, "FROM Foo"));
for (Iterator it = result.iterator(); it.hasNext();) {
Element currentElement = (Element) it.next();
root.add(currentElement);
}
OutputFormat format = OutputFormat.createPrettyPrint();
StringWriter stringBuf = new StringWriter();
XMLWriter writer = new XMLWriter(stringBuf, format);
writer.write(doc);
writer.close();
String resultString = stringBuf.toString();
System.out.println(resultString);
Sollte funktionieren (ein entsprechendes Mapping vorausgesetzt)...
Gruß,
Jan
|
|