I understand why the xmlrootelement annotation is not always generated. Just the same, I have to work with a schema for which JAXB does not (rightly) create the @XmlRootElement. What I need to do is make a string out of the data, then get the JAXB object back out latter.
To create the String, I added a "wrapper" like this:
marshaller.marshal(new JAXBElement(
new QName("
http://mydomain/schema/MyNamesape", "MyMessage"),
MyMessageType.class, request), sw);
However, the code Netbeans creates to convert this String back to an XML object gives me a java.lang.ClassCastException on the resulting Object. I've confirmed that the data (String) is intact, and is what I expect.
Is there a general approach to making a JAXB object with no @XmlRootElement pass through conversion to a String and back again?
Thanks
Thanks