XML : Unmarshal xml with JAXB without annotations

This is a reply to the question above. I don't know why people keep losing their times deleting questions they think are not in their patterns, but ok. Here it go: JAXB Unmarshall without annotation

Thank you for the answer. Dos this work with collections too? I've tried to unmarshall a xml that have a collection inside it, but only the main parameters are unmarshalled, the list is either ignored and null, or when I put the anyElement(lax=true) on the colletion, in is fulfilled with "ElementNSImpl" and when I try to get the values from this list objects, I get:

java.lang.ClassCastException: com.sun.org.apache.xerces.internal.dom.ElementNSImpl cannot be cast to "my type"

If I use the annotated model, everything works fine, but I need exactly to keep using the "normal" model.

Thank you very much for any answers!

No comments:

Post a Comment