Here's my intended XML structure
<Outer type="good" id="1">
<Uid>123</Uid>
<Name>Myself</Name>
<Inner type="bad">This Value</Inner>
</Outer>
Here's my Object.
@XmlAccessorType(XMLAccessType.FIELD)
@XmlType(name="Outer", propOrder = {
"uid"
"name"
"inner"
})
public class Outer{
@XmlElement(name = "Uid")
protected String uid;
@XmlElement(name = "Name")
protected String name;
@XmlElement(name = "Inner")
protected Inner inner;
public static class Inner{
@XmlAttribute
private String type;
@XmlValue
private String value;
//setters & getters for both
}
//setters & getters for all the elements
}
Now in my class I am doing
Outer o = new Outer();
o.setUid/ID/Type/Name() ; //all the setter
Inner i - new Inner();
i.setValue("This Value");
i.setType("bad");
When Irun this i am getting
If a class has @XmlElement property, it cannot have @XmlValue property.
And
Class has two properties of the same name "type" (This one is for the Source class)
And
Class has two properties of the same name "value" (This one is for Source class too)
What is happening, and what I can I do rectify this?
Thanks