Skip to main content

JAXB how to get element name

No replies
suji_prabhu
Offline
Joined: 2013-03-27
Points: 0

Hi,

I am trying to get the element name for a JAXB class.

123

Then if class is SomeElement then what i plan to do is:

getElement(ObjOfSomeElement) --> someelement

I tried the JAXBInstrospector but that requires the classes to have @XMLRootElement.

My generated clases do not have this and i was reading your post for

Why does JAXB put @XmlRootElement sometimes but not always?

in java.net

I tried that but still the XMLRoot element does not get generated.

I am using JDK 1.7. IS your post still valid and also if there any trial way to get the element name.

Thanks,