users@jaxb.java.net

Polymorphism and Code generation

From: Ingrid_Furnzel <ingrid_furnzel_at_gmx.de>
Date: Wed, 17 Dec 2008 04:01:45 -0800 (PST)

Hi,

I have a problem with code generation (xjc) and inheritance.

The following xml structure exists:


   some content
  some content
  some content


a, b and c shall have the same super class

My xsd looks like this:


        
                
                
                
                            


            
            

    
                
                        
                                SOME CONTENT
                        
                
    

    
        
                
                        SOME CONTENT
                
        
    

    
        
                
                        SOME CONTENT
                
        
    


xjc creates five classes (A, B, C, X and Super). Unfortunately, X has three
lists: List a; Listb and List c;

That is not what I want. I would prefer having only one list List super;

In order to do this I could modify the generated code with annotations:
@XmlELements({
    @XmlElement(name="a", type=A.class),
    @XmlElement(name="b", type=B.class),
    @XmlElement(name="c", type=C.class)
})
List super;

How must I write the xsd or the binding file to achieve this behaviour with
code generation? The goal ist to have only one list although I have three
different XML tags (a, b, c).


Regards
Ingrid

-- 
View this message in context: http://www.nabble.com/Polymorphism-and-Code-generation-tp21051962p21051962.html
Sent from the java.net - jaxb users mailing list archive at Nabble.com.