Unfortunately, since in XMLSchema the two types don't share a common
base type, there is no way XMLBeans can factor out a superclass. The
inheritance hierarchy in the generated classes matches the one in the
source XMLSchema. If you really want to use only one interface, then you
would have to use the Extension Interfaces feature
(http://wiki.apache.org/xmlbeans/ExtensionInterfacesFeature) to have
both types extend a common interface that you implement, so then the
rest of your code only deals with this one interface. But the
implementation of this interface may turn out to be tedious.

Radu

> -----Original Message-----
> From: Nick Burch [mailto:[EMAIL PROTECTED] 
> Sent: Friday, April 11, 2008 5:11 AM
> To: [email protected]
> Subject: Two very similar beans, but no common class/interface
> 
> Hi All
> 
> For Apache POI, we're using xmlbeans to generate a whole 
> bunch of classes based on the ooxml schema files. One problem 
> we've found is that some things hold a CT_RPr, and others 
> hold a CT_ParaRPr. Despite these two entries being very 
> similar, the two classes don't have a common class or 
> interface. So, we can't write code to work with the common 
> bits of both these entries very easily.
> 
> Is it possible to get xmlbeans to generate these two classes 
> to share a common superclass or interface, so we can easily 
> get at the common parts?
> 
> The full schema is at http://people.apache.org/~nick/wml.xsd, 
> and the relevent bit is:
>   <xsd:complexType name="CT_RPr">
>     <xsd:sequence>
>       <xsd:group ref="EG_RPrContent" minOccurs="0"></xsd:group>
>     </xsd:sequence>
>   </xsd:complexType>
>   <xsd:complexType name="CT_ParaRPr">
>     <xsd:sequence>
>       <xsd:group ref="EG_ParaRPrTrackChanges" 
> minOccurs="0"></xsd:group>
>       <xsd:group ref="EG_RPrBase" minOccurs="0"></xsd:group>
>       <xsd:element name="rPrChange" type="CT_ParaRPrChange" 
> minOccurs="0">
>         <xsd:annotation>
>           <xsd:documentation>Revision 
> Information....</xsd:documentation>
>         </xsd:annotation>
>       </xsd:element>
>     </xsd:sequence>
>   </xsd:complexType>
>   <xsd:group name="EG_RPrContent">
>     <xsd:sequence>
>       <xsd:group ref="EG_RPrBase" minOccurs="0"></xsd:group>
>       <xsd:element name="rPrChange" type="CT_RPrChange" minOccurs="0">
>         <xsd:annotation>
>           <xsd:documentation>Revision Information 
> for....</xsd:documentation>
>         </xsd:annotation>
>       </xsd:element>
>     </xsd:sequence>
>   </xsd:group>
> 
> (We're generally just after the common bits of EG_RPrBase on 
> both CT_RPr and CT_ParaRPr)
> 
> Thanks
> Nick
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

Notice:  This email message, together with any attachments, may contain 
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated 
entities,  that may be confidential,  proprietary,  copyrighted  and/or legally 
privileged, and is intended solely for the use of the individual or entity 
named in this message. If you are not the intended recipient, and have received 
this message in error, please immediately return this by email and then delete 
it.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to