Click here to Skip to main content
15,881,172 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Performing the conversion from XML to Java classes using JAXB statement.But I am facing some problems. That is, it can successfully convert the values in the attributes in the XML tag.But I can't translate the xml tag's own values. For example I want to convert this into my java calsses:
This is my xml tag line:

<tag>value</tag>


and this is my java classes.

@Data
@XmlAccessorType(XmlAccessType.FIELD)
public class element {
    @XmlAttribute(name = "Id")
    private String Id;
    @XmlAttribute(name = "Composite")
    private String Composite;
    private List<subelement> subelement;
}


when generate java classes from xml file it generates values as like

{
                "subelement": null,
                "id": "BGM01",
                "composite": null
}


What I have tried:

as you can see value of tag 220 are not readed. What did I forget?
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900