创建Unmarshller时出现Jaxb错误

时间:2017-01-08 05:43:05

标签: jaxb unmarshalling

解组XMl时出现以下错误。

com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions
There are two properties named "rad"
    this problem is related to the following location:
        at public byte[] in.gov.uidai.mou.uid_mou_request._1.Mou.getRad()
        at in.gov.uidai.mou.uid_mou_request._1.Mou
    this problem is related to the following location:
        at protected byte[] in.gov.uidai.mou.uid_mou_request._1.Mou.rad
        at in.gov.uidai.mou.uid_mou_request._1.Mou
Class has two properties of the same name "rad"
    this problem is related to the following location:
        at public byte[] in.gov.uidai.mou.uid_mou_request._1.Mou.getRad()
        at in.gov.uidai.mou.uid_mou_request._1.Mou
    this problem is related to the following location:
        at protected byte[] in.gov.uidai.mou.uid_mou_request._1.Mou.rad
        at in.gov.uidai.mou.uid_mou_request._1.Mou

以下是班级。

@XmlRootElement(name = "Mou")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Mou", propOrder = {
        "rad",  
        "oad",
        "appId"
})


public class Mou {

    @XmlElement(name = "Rad", required = true)
    protected byte[] rad;
    @XmlElement(name = "Oad", required = true)
    protected Oad oad;
    @XmlAttribute(name = "ver", required = true)
    protected String ver;
    @XmlAttribute(name = "ts", required = true)
    @XmlSchemaType(name = "dateTime")
    protected XMLGregorianCalendar ts;
    @XmlAttribute(name = "ra", required = true)
    protected RaType ra;
    @XmlAttribute(name = "rc", required = true)
    protected YesType rc;
    @XmlAttribute(name = "nmn", required = true)
    protected String nmn;
    @XmlAttribute(name = "mvc", required = true)
    protected String mvc;
    @XmlAttribute(name = "nem")
    protected String nem;
    @XmlAttribute(name = "dsc")
    protected YesNoType dsc;

    protected String appId;
    @XmlAttribute(name = "appId")

    protected String sa;
    @XmlAttribute(name = "sa")

    protected String txn;
    @XmlAttribute(name = "txn")
    /**
     * Gets the value of the rad property.
     * 
     * @return
     *     possible object is
     *     byte[]
     */

    public byte[] getRad() {
        return this.rad;
    }


    /**
     * Sets the value of the rad property.
     * 
     * @param value
     *     allowed object is
     *     byte[]
     */
    public void setRad(byte[] value) {
        this.rad = ((byte[])value);
    }

    public String getTxn() {
        return txn;
    }

    public void setTxn(String txn) {
        this.txn = txn;
    }


    /**
     * Gets the value of the oad property.
     * 
     * @return
     *     possible object is
     *     {@link Oad }
     *     
     */
    public Oad getOad() {
        return oad;
    }

    /**
     * Sets the value of the oad property.
     * 
     * @param value
     *     allowed object is
     *     {@link Oad }
     *     
     */
    public void setOad(Oad value) {
        this.oad = value;
    }

    /**
     * Gets the value of the ver property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getVer() {
        return ver;
    }

    /**
     * Sets the value of the ver property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setVer(String value) {
        this.ver = value;
    }

    /**
     * Gets the value of the ts property.
     * 
     * @return
     *     possible object is
     *     {@link XMLGregorianCalendar }
     *     
     */
    public XMLGregorianCalendar getTs() {
        return ts;
    }

    /**
     * Sets the value of the ts property.
     * 
     * @param value
     *     allowed object is
     *     {@link XMLGregorianCalendar }
     *     
     */
    public void setTs(XMLGregorianCalendar value) {
        this.ts = value;
    }

    /**
     * Gets the value of the ra property.
     * 
     * @return
     *     possible object is
     *     {@link RaType }
     *     
     */
    public RaType getRa() {
        return ra;
    }

    /**
     * Sets the value of the ra property.
     * 
     * @param value
     *     allowed object is
     *     {@link RaType }
     *     
     */
    public void setRa(RaType value) {
        this.ra = value;
    }

    /**
     * Gets the value of the rc property.
     * 
     * @return
     *     possible object is
     *     {@link YesType }
     *     
     */
    public YesType getRc() {
        return rc;
    }

    /**
     * Sets the value of the rc property.
     * 
     * @param value
     *     allowed object is
     *     {@link YesType }
     *     
     */
    public void setRc(YesType value) {
        this.rc = value;
    }

    /**
     * Gets the value of the nmn property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getNmn() {
        return nmn;
    }

    /**
     * Sets the value of the nmn property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setNmn(String value) {
        this.nmn = value;
    }

    /**
     * Gets the value of the mvc property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getMvc() {
        return mvc;
    }

    /**
     * Sets the value of the mvc property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setMvc(String value) {
        this.mvc = value;
    }

    /**
     * Gets the value of the nem property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getNem() {
        return nem;
    }

    /**
     * Sets the value of the nem property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setNem(String value) {
        this.nem = value;
    }

    /**
     * Gets the value of the dsc property.
     * 
     * @return
     *     possible object is
     *     {@link YesNoType }
     *     
     */
    public YesNoType getDsc() {
        return dsc;
    }

    /**
     * Sets the value of the dsc property.
     * 
     * @param value
     *     allowed object is
     *     {@link YesNoType }
     *     
     */
    public void setDsc(YesNoType value) {
        this.dsc = value;
    }


    public String getAppId() {
        return appId;
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }


    public String getSa() {
        return sa;
    }

    public void setSa(String sa) {
        this.sa= sa;
    }


}

要取消拼接的Xml

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Mou ts="2017-01-08T11:14:36" ver="1.0" ra="F" rc="Y" nmn="9988184067" mvc="23434" nem="" dsc="Y" xmlns="http://www.uidai.gov.in/mou/uid-mou-request/1.0"><Rad>PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9InllcyI/PjxQaWQgdHM9IjIwMTctMDEtMDhUMTE6MTQ6MzYiIHZlcj0iMS4wIiB4bWxucz0iaHR0cDovL3d3dy51aWRhaS5nb3YuaW4vYXV0aGVudGljYXRpb24vdWlkLWF1dGgtcmVxdWVzdC1kYXRhLzEuMCIgLz4=</Rad><Oad uid="789673773233" /></Mou>

0 个答案:

没有答案