-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Beispiel für XML-Export
PostPosted: Fri Apr 21, 2006 6:11 am 
Newbie

Joined: Fri Apr 21, 2006 5:51 am
Posts: 5
Hallo,

ich wollte mal fragen ob es ein Beispiel für den export von daten in xml gibt.

Vielen Dank


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 21, 2006 8:55 am 
Newbie

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


Top
 Profile  
 
 Post subject: DANK
PostPosted: Mon Apr 24, 2006 3:18 am 
Newbie

Joined: Fri Apr 21, 2006 5:51 am
Posts: 5
Danke für das Bsp. ich werde es gleich mal ausprobieren.

THX


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.