JAXB creating Nested Interface from XSD Definition

B

Brett Selleck

We have an issue where the JAXB generated classes are creating an
interface which references itself. The Schema is valid, and I have
not seen this ran into before. The code is below. What is interesting,
is if I change the name of ErrorType to Error the issue goes away.

Has anyone else ran into this issue? Do you have a solution?

The pertanant part of the schema:

<snip>

<xsd:element name="Errors" type="ErrorType"/>
<xsd:complexType name="ErrorType">
<xsd:sequence>
<xsd:element name="Error" maxOccurs="unbounded">
<xsd:complexType>
<xsd:all>
<xsd:element name="ErrorCode">
<xsd:simpleType>
<xsd:restriction base="xsd:string"/>
</xsd:simpleType>
</xsd:element>
<xsd:element name="ErrorMessageText">
<xsd:simpleType>
<xsd:restriction base="xsd:string"/>
</xsd:simpleType>
</xsd:element>
</xsd:all>
<xsd:attribute name="Level" type="xsd:string" use="required"/>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>

</snip>

and the Java Code that JAXB generated

<snip>
//
// This file was generated by the JavaTM Architecture for XML
Binding(JAXB) Reference Implementation, vBeta
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of
the source schema.
// Generated on: 2003.08.29 at 09:35:26 EDT
//


package prime.ccs;


/**
* The following schema fragment specifies the expected content
contained within this java content object.
* <p>
* <pre>
* &lt;complexType name="ErrorType">
* &lt;complexContent>
* &lt;restriction
base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="Error" maxOccurs="unbounded">
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction
base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;all>
* &lt;element name="ErrorCode">
* &lt;restriction
base="{http://www.w3.org/2001/XMLSchema}string">
* &lt;/restriction>
* &lt;/element>
* &lt;element name="ErrorMessageText">
* &lt;restriction
base="{http://www.w3.org/2001/XMLSchema}string">
* &lt;/restriction>
* &lt;/element>
* &lt;/all>
* &lt;attribute name="Level" use="required"
type="{http://www.w3.org/2001/XMLSchema}string" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* &lt;/element>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*/
public interface ErrorType {


java.util.List getError();


/**
* The following schema fragment specifies the expected content
contained within this java content object.
* <p>
* <pre>
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction
base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;all>
* &lt;element name="ErrorCode">
* &lt;restriction
base="{http://www.w3.org/2001/XMLSchema}string">
* &lt;/restriction>
* &lt;/element>
* &lt;element name="ErrorMessageText">
* &lt;restriction
base="{http://www.w3.org/2001/XMLSchema}string">
* &lt;/restriction>
* &lt;/element>
* &lt;/all>
* &lt;attribute name="Level" use="required"
type="{http://www.w3.org/2001/XMLSchema}string" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*/
public interface ErrorType {


String getErrorMessageText();

void setErrorMessageText(String value);

String getLevel();

void setLevel(String value);

String getErrorCode();

void setErrorCode(String value);

}

}


</snip>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top