mkuff
mkuff

Reputation: 1672

Jaxb Element Annotation

How do i annotate my class to archive this xml structure:

<elementTag attribute="false">Testvalue</elementTag>

I tried to put elementTag into a seperate class, but then "Testvalue" is not inline as it is in my example.

Thanks and best regards, m

Upvotes: 1

Views: 320

Answers (1)

bdoughan
bdoughan

Reputation: 148977

You can use the @XmlValue annotation.

@XmlRootElement(name="elementTag")
public class Root {

     @XmlAttribute
     public String getAttribute {
         return attribute;
     }

     @XmlValue
     public String getValue() {
         return value;
     }

}

Upvotes: 2

Related Questions