How Do I create a simple jaxb Java class to represent the following xml
<rootelem>
<myelem name="abc" myatt="true"/>
<myelem name="def">
<Key value="newvalue"/>
</myelem>
<myelem name="xyz">
<Key value="42"/>
</myelem>
</rootelem>
There can be multiple myelem and each myelem can contain multiple key
I do not want to use a xsd
Here is a copy of a class we use to convert to/from XML using JAXB using classes and no XSD. (We also use JAXB to generate our XSD).
EDIT: I just re-read the question. If you’re asking how to generate the Java source from that XML, then you’re going to have to figure that out on your own or use an XSD and use JAXB to convert it to classes. If you already have the class and you want to convert the XML into a Java object, then my code below will work for you.