Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/364.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 在DOJO类中映射@XmlAttribute_Java_Javascript_Json_Rest_Dojo - Fatal编程技术网

Java 在DOJO类中映射@XmlAttribute

Java 在DOJO类中映射@XmlAttribute,java,javascript,json,rest,dojo,Java,Javascript,Json,Rest,Dojo,我有一个Java对象 @XmlAccessorType(XmlAccessType.NONE) @XmlRootElement(name="Slot") public class Slot { @XmlAttribute(name="id") private long id; @XmlElement(name="type") private String type; //.. GETTERS AND SETTERS.... } 我需要通过REST(javax.ws.rs.get)请求从客

我有一个Java对象

@XmlAccessorType(XmlAccessType.NONE)
@XmlRootElement(name="Slot")
public class Slot {

@XmlAttribute(name="id")
private long id;

@XmlElement(name="type")
private String type;

//.. GETTERS AND SETTERS....
}
我需要通过REST(javax.ws.rs.get)请求从客户端获取这个Slot对象

当我从上面的对象创建xml时

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Slot id="123">
    <type>CHART</type>
</Slot>
我需要创建DOJO类来保存UI中的数据,该UI保存id和类型值


如何在DOJO类中表示@attributes?有什么计划性的方法来实现这一点吗?或者我们需要在服务器调用之前使用JSON Stringify/something来实现这一点?

@attributes仅在JSON中,而不是在同一插槽对象的XML中?是的@RE350,它来自XML格式本身。
{
   "Slot":{
      "@attributes":{
         "id":"123"
      },
      "type":"CHART"
   }
}