users@jaxb.java.net

problem with code generated for derived types

From: <Gagan_Bhatnagar_at_i2.com>
Date: Tue, 14 Oct 2003 18:56:34 +0530

Hello,

I've been using JAXB RI 1.0.1 to generate code from XML schemas that
reflect my business data model. I've had no problems so far, but I'm
facing the following issue after I introduced a BaseType in my XML schema
from which other complex types derive.

// cdm.xsd (defines the base type)

  <xsd:complexType name="BaseType">
    <xsd:sequence>
      <xsd:element name="docType" type="DocumentType" minOccurs="1"
maxOccurs="1"/>
      <xsd:element name="revNumber" type="xsd:positiveInteger"
minOccurs="0" maxOccurs="1"/>
      <xsd:element name="docID" type="xsd:string" minOccurs="1"
maxOccurs="1"/>
    </xsd:sequence>
  </xsd:complexType>


// CM.xsd (defines derived type)

  <xsd:complexType name="ContractHeaderType">
    <xsd:complexContent>
      <xsd:extension base="cdm:BaseType">
        <xsd:sequence>
          <xsd:element name="proposalID" type="xsd:string" minOccurs="0"
maxOccurs="1"/>
          <xsd:element name="isContractEditable" type="Boolean"
minOccurs="0" maxOccurs="1"/>
        ...
        ...
        ...
        </xsd:sequence>
        <xsd:attribute name="OID" use="required" type="xsd:string"/>
        <xsd:attribute name="exploreLabel" use="required"
type="xsd:string" fixed="Contract Header"/>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>

The generated interface for ContractHeaderType looks like as follows:

public interface ContractHeaderType extends
com.i2.srm.integration.gen.cdm.BaseType
{
        public final static java.lang.String EXPLORE_LABEL = "Contract
Header";

        java.util.List getRest();

        java.lang.String getOID();
        void setOID(java.lang.String value);

        // interface definitions of the elements..

        public interface ProposalID extends javax.xml.bind.Element
        {
                java.lang.String getValue();
                void setValue(java.lang.String value);
        }

        public interface IsContractEditable extends javax.xml.bind.Element
        {
                java.lang.String getValue();
                void setValue(java.lang.String value);
        }

        ...
        ...
        ...
}

The generated code in ContractHeaderType is not what I expected. I would
like to be able to access the elements of the derived type
(ContractHeaderType) using get and set methods. Instead I see a single
getRest method that returns a List (as was the case before I added
"<xsd:extension base="cdm:BaseType">").

How should I define the schema to generate methods like getProposalID( ) &
getIsContractEditable( ) while still using the 'extension' ??

Thanks in advance!

- Gagan