attribute inheritance

View: New views
1 Messages — Rating Filter:   Alert me  

attribute inheritance

by Anders Hessellund-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Suppose you have the following schema:

 <xs:complexType name="XB">
   <xs:attribute name="a1" type="xs:int"/>
   <xs:attribute name="a2" type="xs:int" default="2"/>
 </xs:complexType>

 <xs:complexType name="X1">
   <xs:complexContent>
     <xs:restriction base="XB">
       <xs:attribute name="a1" type="xs:int" default="11"/>
     </xs:restriction>
   </xs:complexContent>
 </xs:complexType>

 <xs:complexType name="X2">
   <xs:complexContent>
     <xs:restriction base="XB">
       <xs:attribute name="a1" type="xs:int" default="21"/>
     </xs:restriction>
   </xs:complexContent>
 </xs:complexType>

You get the following generated code

 public class XB {
   @XmlAttribute
   protected Integer a1;
   @XmlAttribute
   protected Integer a2;

   public Integer getA1() {
     return a1;
   }

   ...

   public int getA2() {
     if (a2 == null) {
       return 2;
       } else {
       return a2;
     }
   }
   ...
 }

 public class X1
 extends XB
 {
 }

 public class X2
 extends XB
 {
 }

Why are attributes not generated in the subclasses? Is this a bug? It
seems like a fairly trivial thing to do (without knowing anything
about the implementation).

Cheers,

Anders

--
Anders Hessellund
www.itu.dk/people/hessellund/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...