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>
* <complexType name="ErrorType">
* <complexContent>
* <restriction
base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="Error" maxOccurs="unbounded">
* <complexType>
* <complexContent>
* <restriction
base="{http://www.w3.org/2001/XMLSchema}anyType">
* <all>
* <element name="ErrorCode">
* <restriction
base="{http://www.w3.org/2001/XMLSchema}string">
* </restriction>
* </element>
* <element name="ErrorMessageText">
* <restriction
base="{http://www.w3.org/2001/XMLSchema}string">
* </restriction>
* </element>
* </all>
* <attribute name="Level" use="required"
type="{http://www.w3.org/2001/XMLSchema}string" />
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </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>
* <complexType>
* <complexContent>
* <restriction
base="{http://www.w3.org/2001/XMLSchema}anyType">
* <all>
* <element name="ErrorCode">
* <restriction
base="{http://www.w3.org/2001/XMLSchema}string">
* </restriction>
* </element>
* <element name="ErrorMessageText">
* <restriction
base="{http://www.w3.org/2001/XMLSchema}string">
* </restriction>
* </element>
* </all>
* <attribute name="Level" use="required"
type="{http://www.w3.org/2001/XMLSchema}string" />
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*/
public interface ErrorType {
String getErrorMessageText();
void setErrorMessageText(String value);
String getLevel();
void setLevel(String value);
String getErrorCode();
void setErrorCode(String value);
}
}
</snip>
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>
* <complexType name="ErrorType">
* <complexContent>
* <restriction
base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="Error" maxOccurs="unbounded">
* <complexType>
* <complexContent>
* <restriction
base="{http://www.w3.org/2001/XMLSchema}anyType">
* <all>
* <element name="ErrorCode">
* <restriction
base="{http://www.w3.org/2001/XMLSchema}string">
* </restriction>
* </element>
* <element name="ErrorMessageText">
* <restriction
base="{http://www.w3.org/2001/XMLSchema}string">
* </restriction>
* </element>
* </all>
* <attribute name="Level" use="required"
type="{http://www.w3.org/2001/XMLSchema}string" />
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </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>
* <complexType>
* <complexContent>
* <restriction
base="{http://www.w3.org/2001/XMLSchema}anyType">
* <all>
* <element name="ErrorCode">
* <restriction
base="{http://www.w3.org/2001/XMLSchema}string">
* </restriction>
* </element>
* <element name="ErrorMessageText">
* <restriction
base="{http://www.w3.org/2001/XMLSchema}string">
* </restriction>
* </element>
* </all>
* <attribute name="Level" use="required"
type="{http://www.w3.org/2001/XMLSchema}string" />
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*/
public interface ErrorType {
String getErrorMessageText();
void setErrorMessageText(String value);
String getLevel();
void setLevel(String value);
String getErrorCode();
void setErrorCode(String value);
}
}
</snip>