Jaxb @Attribute错误读取属性

时间:2014-05-08 09:07:24

标签: jaxb

我有代码和xml和xml,无法读取xml并认为它是属性的。我该如何阅读属性? 这是代码:

@XmlRootElement(name = "reimpresiones")
public class RePrint {

    private Integer id;
    private String document;
    private String numberDocument;
    private String extraction;
    private String client;
    private String groupExtraction;
    private String route;
    private String deliveryNote;
    private String date;
    private List<RePrint> reprintList;

    public RePrint() {
    }

    @XmlAttribute(name = "id")  
    public Integer getId() {
        return id;
    }

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

    @XmlElement(name = "client")
    public String getClient() {
        return client;
    }

    public void setClient(String client) {
        this.client = client;
    }

    @XmlElement(name = "document")
    public String getDocument() {
        return document;
    }

    public void setDocument(String document) {
        this.document = document;
    }

    @XmlElement(name = "numberDocument")
    public String getNumberDocument() {
        return numberDocument;
    }

    public void setNumberDocument(String numberDocument) {
        this.numberDocument = numberDocument;
    }

    @XmlElement(name = "extraction")
    public String getExtraction() {
        return extraction;
    }

    public void setExtraction(String extraction) {
        this.extraction = extraction;
    }

    @XmlElement(name = "groupExtraction")
    public String getGroupExtraction() {
        return groupExtraction;
    }

    public void setGroupExtraction(String groupExtraction) {
        this.groupExtraction = groupExtraction;
    }

    @XmlElement(name = "route")
    public String getRoute() {
        return route;
    }

    public void setRoute(String route) {
        this.route = route;
    }

    @XmlElement(name = "deliveryNote")
    public String getDeliveryNote() {
        return deliveryNote;
    }

    public void setDeliveryNote(String deliveryNote) {
        this.deliveryNote = deliveryNote;
    }

    @XmlElement(name = "date")
    public String getDate() {
        return date;
    }

    public void setDate(String date) {
        this.date = date;
    }

    @XmlElement(name = "reimprension")
    public List<RePrint> getReprintList() {
        return reprintList;
    }

    public void setReprintList(List<RePrint> reprintList) {
        this.reprintList = reprintList;
    }

}

这是xml,其中有一个元素列表。我想读“id”,但我不能。

<reimpresiones>
    <reimpresion id="10574691840591525620140557591784">
        <document>MATRICULA</document>
        <numdocument><![CDATA[M142849865     ]]></numdocument>
        <groupExtraction>1849986</groupExtraction>
        <extraction>919767</extraction>
        <client>780</client>
        <deliveryNote><![CDATA[3600445640/01  ]]></deliveryNote>
        <route>BUY</route>
        <date>2014-05-05-17.59.57.919200</date>
    </reimpresion>
    <reimpresion id="14081953280539172820140537251728">
        <document>MATRICULA</document>
        <numdocument><![CDATA[M142849864     ]]></numdocument>
        <groupExtraction>1849986</groupExtraction>
        <extraction>919767</extraction>
        <client>780</client>
        <deliveryNote><![CDATA[3600445640/01  ]]></deliveryNote>
        <route>BUY</route>
        <date>2014-05-05-17.25.37.427752</date>
    </reimpresion>
</reimpresiones>

谢谢

0 个答案:

没有答案