Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > JAXB creating Nested Interface from XSD Definition

Reply
Thread Tools

JAXB creating Nested Interface from XSD Definition

 
 
Brett Selleck
Guest
Posts: n/a
 
      09-03-2003
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>
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
polymorphism in jaxb and xsd Elhanan Java 0 05-16-2006 08:01 PM
polymorphism in jaxb and xsd Elhanan Java 0 05-16-2006 08:00 PM
Jaxb and xsd Help requested Anna Java 0 05-08-2006 02:34 PM
JAXB creating Nested Interface from XSD Definition Brett Selleck XML 0 09-03-2003 07:17 PM



Advertisments