users@jaxb.java.net

Re: Name collisions

From: Ed Mooney <Ed.Mooney_at_Sun.COM>
Date: Fri, 07 Mar 2003 09:38:39 -0500

Hi Nick,

The schema defines several pairs of complex types with one member having
the name "foo-bar" and the other "foo-bar-type". xjc wants to create
interfaces with the name "FooBar" and "FooBarType" (for the first
member) and "FooBarType" and "FooBarTypeType" (for the second member),
resulting in a collision of "FooBarType".

The enclosed external binding file resolves this conflict for one such
pair. Add additional inner-most "jaxb:bindings" elements for the other
pairs.

Regards,
--
Ed Mooney         |Sun Microsystems, Inc.|Time flies like
Java Web Services |UBUR02-201            |an arrow, but
Ed.Mooney_at_Sun.COM |1 Network Drive       |fruit flies like
781-442-0459      |Burlington, MA  01803 |a banana. Groucho
Nick Betteridge wrote:
> Hi
>
> I'm new to this, so apologies for the basic question relating to a basic
> problem
>
> I've just hit my first problem with name collisions and I'm not having
> much luck. I'm trying to generate classes for the servlet schema
> web-app_2_3.xsd and I get errors with class/interface use.
>
> I've written a bindings file in order to circumnavigate the name
> collisions but keep getting the same error when using the bindings -
> 'premature end of file' - and it looks OK to me.
>
>
> I would be very grateful if someone could cast a quick eye over this and
> point out my shortcomings.
>
> Thanks
>
> Nick
>
[ ... ]


<jaxb:bindings xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
               xmlns:xs="http://www.w3.org/2001/XMLSchema"
               version="1.0">
  <jaxb:bindings schemaLocation="web-app_2_3.xsd" node="/xs:schema">
    <jaxb:bindings node="./xs:element[@name='env-entry-type']">
      <jaxb:class name="envEntryTypeX"/>
    </jaxb:bindings>
  </jaxb:bindings>
</jaxb:bindings>