How can I produce the following XML fragment using JAXB?
如何使用JAXB生成以下XML片段?
<sequence md5="1de2cf633901ff1f00785735c8ce7e70">MPTINSALRKVARVRLTSG</sequence>
My class is as follows:
我的班级如下:
@XmlType(name = "SequenceType")
public class Sequence {
private String md5;
private String sequence;
@XmlAttribute
public String getMd5() {
return md5;
}
// JAXB annotation here??
public String getSequence() {
return sequence;
}
}
1 个解决方案
#1
12
@XmlValue on the sequence property.
序列属性上的@XmlValue。
@XmlType(name = "SequenceType")
public class Sequence {
private String md5;
private String sequence;
@XmlAttribute
public String getMd5() {
return md5;
}
@XmlValue
public String getSequence() {
return sequence;
}
}
#1
12
@XmlValue on the sequence property.
序列属性上的@XmlValue。
@XmlType(name = "SequenceType")
public class Sequence {
private String md5;
private String sequence;
@XmlAttribute
public String getMd5() {
return md5;
}
@XmlValue
public String getSequence() {
return sequence;
}
}