As you can see Wheel has two elements colour and size. In JAXB, to represent this I could have a JAXB Car class and a JAXB Wheel class.
But I think this is overkill. I would like to represent this structure as just one JAXB class: Car.
Is there any way to do this?
Also, just say the in Java the only element I am in interested in the Wheel is the colour, it is possible to just get this element into a JAXB Car class anyway?
Thanks
Jimmy Clark
Ranch Hand
Joined: Apr 16, 2008
Posts: 2159
posted
0
Aside, you could write your own code to read the XML-based document and create whatever objects you want without using the JAXB API.
Luke Murphy
Ranch Hand
Joined: May 12, 2010
Posts: 295
posted
0
Jimmy Clark wrote:Aside, you could write your own code to read the XML-based document and create whatever objects you want without using the JAXB API.
Correct. If I was only looking for one attribute, I do that and use DOM /XPATH.
I want to avoid writing marshalling code and use JAXB as much as I can here.
Jimmy Clark
Ranch Hand
Joined: Apr 16, 2008
Posts: 2159
posted
0
So you will get a Car object and a Wheel object ... and like it