We have a requirement where XML tags are not similar to java POJO attributes.
We need a solution to map XML tags to POJO with different name.
Here is the same XML,
<RES>
<TAG1>
value
</TAG1>
</RES>
Here is the POJO class,
public class Response {
protected String tag1Value;
...}
Here I want to map to tag1Value in POJO.
I have found below syntax can be used to map XML to java attributes.
public class Response {
@XmlElement(name="TAG1")
protected String tag1Value;
...}
But I want to know how to configure this in XSD, so that POJO can be generated with name attribute in XMLElement.
With the below XSD how to specify java attribute name and XML nae together,
<xsd:element name="tag1Value" minOccurs="0" maxOccurs="1">
Help appreciated...