Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/305.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 简单XML@Text导致异常_Java_Xml_Simple Framework - Fatal编程技术网

Java 简单XML@Text导致异常

Java 简单XML@Text导致异常,java,xml,simple-framework,Java,Xml,Simple Framework,我有这样一个简单的类: public static class MyData { @Text(required = false) protected String value; @Attribute(required = true) protected String id; @Text public String getValue() { return value;

我有这样一个简单的类:

    public static class MyData {

        @Text(required = false)
        protected String value;
        @Attribute(required = true)
        protected String id;

        @Text
        public String getValue() {
            return value;
        }

        @Text
        public void setValue(String value) {
            this.value = value;
        }

        public String getId() {
            return id;
        }

        public void setId(String value) {
            this.id = value;
        }
}

它导致了一个异常:

Exception Text annotation 
  @org.simpleframework.xml.Text(data=false, empty=, required=true) 
on method 'value' used with elements in class MyData
实际的XML是:

  <MyData id="fakeId">An HTTP Link is here</MyData>
这里有一个HTTP链接
任何想法:
我尝试了一些组合,比如在getValue/setValue处没有
@Text
注释,但似乎没有帮助

问题在于上课前的注释。 @默认值(DefaultType.FIELD) @顺序(元素={ })

移除上述管线后,其工作正常