JAXB creating Nested Interface from XSD Definition

Discussion in 'XML' started by Brett Selleck, Sep 3, 2003.

  1. 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>
    Brett Selleck, Sep 3, 2003
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Brett Selleck
    Replies:
    0
    Views:
    777
    Brett Selleck
    Sep 3, 2003
  2. Replies:
    6
    Views:
    5,031
  3. Anna
    Replies:
    0
    Views:
    611
  4. Elhanan

    polymorphism in jaxb and xsd

    Elhanan, May 16, 2006, in forum: Java
    Replies:
    0
    Views:
    836
    Elhanan
    May 16, 2006
  5. Sri
    Replies:
    1
    Views:
    321
    Arved Sandstrom
    Feb 17, 2013
Loading...

Share This Page