users@jaxb.java.net

AW: duplicate classes error?

From: Nick Pellow <nick.pellow_at_mindmatics.de>
Date: Tue, 20 Jul 2004 10:43:25 +0200

Hi Joe,

Thanks for the answer. Fortunately the Schema was not too complicated so I
just tweaked it to remove the name clash. I learnt a lot more about XSD in
the process of doing so. Things are working well now.

Cheers,
Nick.

>-----Ursprüngliche Nachricht-----
>Von: Joe Fialli [mailto:Joseph.Fialli_at_Sun.COM]
>Gesendet: Montag, 19. Juli 2004 15:18
>An: users_at_jaxb.dev.java.net
>Betreff: Re: duplicate classes error?
>
>
>
>Nick,
>
>You have a global element declaration and global complex type definition
>with the same
>name. XML Schema namespaces allows elements and type definitions to
>have same name
>since they are in different symbol spaces. When mapping to Java, they
>collide.
>
>You can either change the schema so global elements and complex type
>definitions
>do not have the same name OR you can use a JAXB customization to specify
>a different schema-derived class name for the elements or complex type
>definitions.
>
>There is a sample called "fix-collides" that shows one possible way to
>systematically
>remove collisions if your schema has many global elements and complex
>type definitions
>with the same name. Sample "inline-customize" demonstrates how to
>customize by specifying
>the Java class name for the schema-derived class for either a global
>element or named
>complex type definition.
>
>-Joe Fialli, Sun Microsystems
>
>
>Nick Pellow wrote:
>
>>Hi,
>>
>>I have attached an XSD I am attempting to generate classes from using
>>JAXB. For some reason, I believe, JAXB does not handle the xs:extension
>>element too well.
>>
>>I get the following errors when running xjc over the xsd:
>>
>> [xjc] [ERROR] A class/interface with the same name
>>"com.mindmatics.sms.transport.crisp.Credentials" is already in use.
>> [xjc] line 37 of crisp_1_0.xsd
>>
>> [xjc] [ERROR] (Relevant to above error) another one is generated
>from here.
>> [xjc] line 32 of crisp_1_0.xsd
>>
>> [xjc] [ERROR] A class/interface with the same name
>>"com.mindmatics.sms.transport.crisp.Status" is already in use.
>> [xjc] line 67 of crisp_1_0.xsd
>>
>> [xjc] [ERROR] (Relevant to above error) another one is generated
>from here.
>> [xjc] line 62 of crisp_1_0.xsd
>>
>>Is this a known problem, or am I doing something wrong? If I use an XSD
>>without
>>the
>> <xs:extension base="credentials">
>>or
>>
>> <xs:extension base="status">
>>elements, JAXB generates the classes without a problem.
>>
>>Has anyone else seen this before?
>>
>>Cheers,
>>Nick.
>>
>>
>>------------------------------------------------------------------------
>>
>><?xml version="1.0" encoding="UTF-8"?>
>><!--
>> Crisp CCTP control part DTD
>> (c) 2003 T-Mobile
>> Version: 1.0 (Feb/12/2003)
>>-->
>><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
>elementFormDefault="qualified">
>> <xs:element name="crisp">
>> <xs:complexType>
>> <xs:choice>
>> <xs:element ref="login"/>
>> <xs:element ref="login-response"/>
>> <xs:element ref="forward"/>
>> <xs:element ref="forward-response"/>
>> <xs:element ref="logout"/>
>> <xs:element ref="logout-response"/>
>> <xs:element ref="error-response"/>
>> </xs:choice>
>> <xs:attribute name="request_id" use="required"/>
>> </xs:complexType>
>> </xs:element>
>> <xs:element name="forward">
>> <xs:complexType>
>> <xs:complexContent>
>> <xs:extension base="credentials">
>> <xs:attribute name="service_id" use="required"/>
>> <xs:attribute name="message_type" use="required"/>
>> </xs:extension>
>> </xs:complexContent>
>> </xs:complexType>
>> </xs:element>
>> <xs:complexType name="credentials">
>> <xs:sequence>
>> <xs:element ref="credentials"/>
>> </xs:sequence>
>> </xs:complexType>
>> <xs:element name="credentials">
>> <xs:complexType>
>> <xs:attribute name="session_id" use="required"/>
>> </xs:complexType>
>> </xs:element>
>> <xs:element name="forward-response" type="status"/>
>> <xs:element name="login">
>> <xs:complexType>
>> <xs:sequence>
>> <xs:element ref="partner_id"/>
>> <xs:element ref="password"/>
>> </xs:sequence>
>> </xs:complexType>
>> </xs:element>
>> <xs:element name="partner_id" type="xs:string"/>
>> <xs:element name="password" type="xs:string"/>
>> <xs:element name="login-response">
>> <xs:complexType>
>> <xs:complexContent>
>> <xs:extension base="status">
>> <xs:attribute name="session_id"/>
>> </xs:extension>
>> </xs:complexContent>
>> </xs:complexType>
>> </xs:element>
>> <xs:complexType name="status">
>> <xs:sequence>
>> <xs:element ref="status"/>
>> </xs:sequence>
>> </xs:complexType>
>> <xs:element name="status">
>> <xs:complexType mixed="true">
>> <xs:attribute name="code" use="required"/>
>> </xs:complexType>
>> </xs:element>
>> <xs:element name="logout">
>> <xs:complexType>
>> <xs:attribute name="session_id" use="required"/>
>> </xs:complexType>
>> </xs:element>
>> <xs:element name="logout-response" type="status"/>
>> <xs:element name="error-response" type="status"/>
>></xs:schema>
>>
>>
>>
>>------------------------------------------------------------------------
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
>>For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>>
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
>For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net