users@jaxb.java.net

Dealing with inheritance and multiple packages

From: Dan Diephouse <dan_at_envoisolutions.com>
Date: Mon, 22 May 2006 23:06:53 -0400

I am trying to figure out how one would handle inheritance where some of
the classes may be in an unknown package. For instance - take this type
which may be in namespace 1:

    <s:complexType abstract="true" name="BaseUser">
      <s:sequence>
         <s:element name="name" type="s:string"/>
      </s:sequence>
    </s:complexType>

And this type in namespace 2:

  <s:complexType name="Employee">
    <s:complexContent mixed="false">
      <s:extension base="i:BaseUser">
         <s:sequence>
           <s:element name="division" type="s:string"/>
         </s:sequence>
      </s:extension>
    </s:complexContent>
  </s:complexType>

All I know in this case is that I'm going to receive a type of BaseUser.
But I have no clue about the Employee class. JAXB doesn't know about
this class either, because it will throw an exception like
"[javax.xml.bind.JAXBException: xfire.inheritance.BaseUser is not known
to this context]".

Any ideas on how to get around this without specifying all the
individual subclasses/packages?

Cheers,
- Dan

-- 
Dan Diephouse
Envoi Solutions
http://envoisolutions.com
http://netzooid.com/blog