Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/194.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
java中的xStream反序列化 迈克尔·丹尼尔斯 2012-10-20 2012-10-25 2012-10-11 取代 假期 2. 拔掉智齿的。 早日康复 迈克尔·丹尼尔斯 2012-11-12 2012-11-15 2012-10-19 取代 假期 2. 我的狗吃了我的作业,所以我不能来上班。_Java_Android_Xml_Xstream - Fatal编程技术网

java中的xStream反序列化 迈克尔·丹尼尔斯 2012-10-20 2012-10-25 2012-10-11 取代 假期 2. 拔掉智齿的。 早日康复 迈克尔·丹尼尔斯 2012-11-12 2012-11-15 2012-10-19 取代 假期 2. 我的狗吃了我的作业,所以我不能来上班。

java中的xStream反序列化 迈克尔·丹尼尔斯 2012-10-20 2012-10-25 2012-10-11 取代 假期 2. 拔掉智齿的。 早日康复 迈克尔·丹尼尔斯 2012-11-12 2012-11-15 2012-10-19 取代 假期 2. 我的狗吃了我的作业,所以我不能来上班。,java,android,xml,xstream,Java,Android,Xml,Xstream,我正在经历一段可怕的时间,弄清楚xstream想让我如何设置它。。。。这就是我目前正在做的: <requests> <request id="246"> <employee id="40350">Michael Daniels</employee> <start>2012-10-20</start> <end>2012-10-25</end&g

我正在经历一段可怕的时间,弄清楚xstream想让我如何设置它。。。。这就是我目前正在做的:

<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>
类持有者
{
请求;
@XStreamAlias(“请求”)
公共静态类请求
{
列表请求=新建ArrayList();
}
@XStreamAlias(“请求”)
公共静态类请求
{
int-id;
员工;
字符串开始;
弦端;
创建字符串;
地位;
类型;
金额;
注释;
}
公共静态类雇员
{
int-id;
字符串内容;
}
公共静态类状态
{
字符串内容;
字符串已更改;
int lastchangedbyserid;
}
公共静态类类型
{
int-id;
字符串内容;
}
公共静态类数量
{
弦单元;
智力内容;
}
公共静态课堂笔记
{
列表注释=新建ArrayList();
}
公共静态类注释
{
串从;
字符串内容;
}
}

有人能帮我弄清楚如何设置结构,以便xstream从上述xml中填充它吗?

我认为您需要静态类中的getter和setter结构,就像公共静态类Employee中的“int id”和“String content”一样

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;
    }
}