Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #5548
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!nx02.iad01.newshosting.com!newshosting.com!69.16.185.16.MISMATCH!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!postnews.google.com!gv8g2000vbb.googlegroups.com!not-for-mail |
|---|---|
| From | Stefanie Ertheld <Dooing@gmx.de> |
| Newsgroups | comp.lang.java.programmer |
| Subject | [Jaxb] |
| Date | Wed, 22 Jun 2011 13:08:17 -0700 (PDT) |
| Organization | http://groups.google.com |
| Lines | 63 |
| Message-ID | <7c49f151-0f1b-4e5c-936d-ce42e8261c55@gv8g2000vbb.googlegroups.com> (permalink) |
| NNTP-Posting-Host | 95.91.6.219 |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1 |
| X-Trace | posting.google.com 1308773766 32461 127.0.0.1 (22 Jun 2011 20:16:06 GMT) |
| X-Complaints-To | groups-abuse@google.com |
| NNTP-Posting-Date | Wed, 22 Jun 2011 20:16:06 +0000 (UTC) |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | gv8g2000vbb.googlegroups.com; posting-host=95.91.6.219; posting-account=7WjHKwkAAACYARGd4NwwOEu2-005tc5a |
| User-Agent | G2/1.0 |
| X-Google-Web-Client | true |
| X-Google-Header-Order | HUALESNKRC |
| X-HTTP-UserAgent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20100101 Firefox/5.0,gzip(gfe) |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:5548 |
Show key headers only | View raw
Hi,
I've got an xml document like this:
<xml version="1.0 encoding="UTF-8">
<employees id="1" room="123">
<employee>
<firstname>Peter</firstname>
<lastname>Meyer</lastname>
</employee>
<employee>
<firstname>Betty</firstname>
<lastname>Boo</lastname>
</employee>
</employees>
How can that be mapped to jaxb annotations?
I've tried all sorts of things, like:
@XmlRootElement(name = "employees")
@XmlAccessorType(XmlAccessType.FIELD)
public class Employees {
@XmlAttribute(name = "id")
private String id;
@XmlAttribute(name = "room")
private String room;
@XmlElement(name = "employee")
@XmlElementWrapper(name = "employees")
private Employee[] employees;
[...]
However, this doesn't work. There is a problem with the employees
Element.
On Google I found various examples of the type:
<company>
<employees id="1" room="123">
<employee>
<firstname>Peter</firstname>
<lastname>Meyer</lastname>
</employee>
<employee>
<firstname>Betty</firstname>
<lastname>Boo</lastname>
</employee>
<employees>
</company>
This works easily - however when the document
root element is also at the same time a list,
I can't get it to work.
Any ideas?
Thanks in advance,
Stefanie
Back to comp.lang.java.programmer | Previous | Next | Find similar
[Jaxb] Stefanie Ertheld <Dooing@gmx.de> - 2011-06-22 13:08 -0700
csiph-web