0
<requests>
<request id="246">
<employee id="40350">Michael Daniels</employee>
<start>2012-10-20</start>
<end>2012-10-25</end>
<created>2012-10-11</created>
<status lastChanged="2012-10-24" lastChangedByUserId="2270">superceded</status>
<type id="4">Vacation</type>
<amount unit="hours">2</amount>
<notes>
<note from="employee">Having wisdom teeth removed.</note>
<note from="manager">Get well soon</note>
</notes>
</request>
<request id="248">
<employee id="40350">Michael Daniels</employee>
<start>2012-11-12</start>
<end>2012-11-15</end>
<created>2012-10-19</created>
<status lastChanged="2012-10-30" lastChangedByUserId="2270">superceded</status>
<type id="4">Vacation</type>
<amount unit="hours">2</amount>
<notes>
<note from="employee">My dog ate my homework so I can't come to work.</note>
</notes>
</request>
我有搞清楚如何XStream的要我設置這個了一個可怕的時間
....這是我目前在做什麼:XSTREAM反序列化在Java
class Holder
{
Requests requests;
@XStreamAlias("requests")
public static class Requests
{
List<Request> requests = new ArrayList<Request>();
}
@XStreamAlias("request")
public static class Request
{
int id;
Employee employee;
String start;
String end;
String created;
Status status;
Type type;
Amount amount;
Notes notes;
}
public static class Employee
{
int id;
String content;
}
public static class Status
{
String content;
String lastChanged;
int lastChangedByUserId;
}
public static class Type
{
int id;
String content;
}
public static class Amount
{
String unit;
int content;
}
public static class Notes
{
List<Note> notes = new ArrayList<Note>();
}
public static class Note
{
String from;
String content;
}
}
Coud有人請幫助我想出瞭如何設置結構,以便xstream從bove xml中填充它?