How can I add an attribute to a text element in JAXB?

How can I produce the following XML fragment using JAXB?

<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;
    }

}

Answers


@XmlValue on the sequence property.

@XmlType(name = "SequenceType")
public class Sequence {

    private String md5;
    private String sequence;

    @XmlAttribute
    public String getMd5() {
        return md5;
    }

    @XmlValue
    public String getSequence() {
        return sequence;
    }

}

Need Your Help

Set Deafult Language for Code Engineering

enterprise-architect

May this is not the place to ask such a thing, but there are several experts here...

two UIView Animation on the same image

iphone xcode animation methods uiimageview

Well I would like to have two UIView animation on a same image in the same method like this :

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.