此xml文件的marshal / unmarshal的等效类

时间:2015-10-16 20:05:15

标签: java xml marshalling unmarshalling

在java中编组/解组此xml文件的等效类是什么?

<display-type>
        <value default="true">Document</value>
        <value>GenericNode:144</value>
  </display-type>

1 个答案:

答案 0 :(得分:0)

@XmlRootElement(name = DisplayType.DISPLAY_TYPE)
@XmlAccessorType(XmlAccessType.NONE)
public class DisplayType {

    static final String DISPLAY_TYPE = "display-type";
    private static final String DEFAULT = "default";


    @XmlAttribute(name = DEFAULT)
    private Boolean defaultName;


    @XmlValue
    private String name;
}