Reputation: 41
<Response>
<Play loop=10>
https:aws-mp3-file-locaation.com
</Play>
</Response>
What I implemented:
@XmlRootElement(name = "Response")
public CustomResponse{
private String play;
private int loop;
@XmlElement(name = "Play")
public String getPlay() {
return play;
}
public void setPlay(String play) {
this.play = play;
}
@XmlAttribute(name = "loop")
public String getLoop() {
return loop;
}
public void setLoop(String loop) {
this.loop = loop;
}
}
This is returning the loop value as a response attribute.
<Response loop=10>
<Play>
https:aws-mp3-file-locaation.com
</Play>
</Response>
@XmlRootElement(name = "Response")
public CustomResponse{
private Play play;
@XmlElement(name = "Play")
public Play getPlay() {
return play;
}
public void setPlay(Play play) {
this.play = play;
}
}
@XmlRootElement(name = "Play")
public PlayResponse{
private String play;
private int loop;
@XmlElement(name = "play")
public String getPlay() {
return play;
}
public void setPlay(String play) {
this.play = play;
}
@XmlAttribute(name = "loop")
public String getLoop() {
return loop;
}
public void setLoop(String loop) {
this.loop = loop;
}
}
This is returning
<Response>
<Play>
<play loop=10>
https:aws-mp3-file-locaation.com
</play>
</Play>
</Response>
Upvotes: 1
Views: 910