Jaxb doesn't generate Interface for element of complex type

Posted by user275886 on Stack Overflow See other posts from Stack Overflow or by user275886
Published on 2010-06-03T10:43:23Z Indexed on 2010/06/03 10:44 UTC
Read the original article Hit count: 265

Filed under:

I have an xsd (for basecamp xml) that contains

    <xsd:complexType name="ProjectType">
    <xsd:sequence>
        <xsd:element name="announcement"
type="TypedNilableStringElementType"
maxOccurs="1" minOccurs="1">
        </xsd:element>
        <xsd:element name="created-on"
type="TypedDateElementType" maxOccurs="1"
minOccurs="1">
        </xsd:element>


        <xsd:element name="id"
type="TypedIntegerElementType" maxOccurs="1"
minOccurs="1">
        </xsd:element>
        <xsd:element name="last-changed-on"
type="TypedDateTimeElementType" maxOccurs="1"
minOccurs="1">
        </xsd:element>
        <xsd:element name="name" type="xsd:string" maxOccurs="1"
minOccurs="1">
        </xsd:element>
        <xsd:element name="show-announcement"
type="TypedBooleanElementType" maxOccurs="1"
minOccurs="1">
        </xsd:element>
        <xsd:element name="show-writeboards"
type="TypedBooleanElementType" maxOccurs="1"
minOccurs="1">
        </xsd:element>
        <xsd:element name="start-page" type="xsd:string"
maxOccurs="1" minOccurs="1">
        </xsd:element>
        <xsd:element name="status" type="xsd:string" maxOccurs="1"
minOccurs="1">
        </xsd:element>
        <xsd:element name="company"
type="SimpleCompanyType" maxOccurs="1" minOccurs="1">
        </xsd:element>
    </xsd:sequence>
</xsd:complexType>

and

<xsd:element name="project" type="ProjectType">
</xsd:element>

I'm looking at http://java.sun.com/javaee/5/docs/tutorial/doc/bnbah.html and can't understand what I'm doing different from the sample schema in Table 17-13 where there is an element named purchaseOrder of type PurchaseOrderType. According to the tutorial, running xjc on the schema, one will get PurchaseOrder.java interface and PurchaseOrderType.java interface. When I run xjc on my schema I only get a ProjectType.java class, and when the xml actually consist of a single element, this won't parse, because there are no Project.java class/interface to match.

© Stack Overflow or respective owner

Related posts about jaxb