jaxb inheritance custom mapping

Areha404

New Member
I have those classes\[code\]@XmlRootElementpublic class Root{ @element public B element = new B(); }public abstract class A {}public class B extends A{ @XmlElement String param1; @XmlElement String param2; public B(){ param1 = "0"; param2 = "102"; }}they both belong to a root elementand I want to create this XML<root> <A> <B> <param1>0</param1> <param2>102</param2> </B> </A></root> \[/code\]It is possible to do that or I will have to create a List(one element list) and than use@XmlWrapperElement annotation?As requested I will past the real src code, but it is a little big.
This is what jaxb generated
pastebin.com/Nccnv52W
The problem is that my xsd looks like that
pastebin.com/mpdMs2zF
as you can see, it is a choice element so I cant have something like this pastebin.com/VBQaSft5
otherwise I will have validation problems unmarshaling the XMLs
 
Back
Top