users@jaxb.java.net

Re: Q: Element and Attribute with the same identifier

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Fri, 30 Mar 2007 12:38:41 -0700

Herve Bitteur wrote:
> I'm using xjc on an XML schema to get the corresponding Java classes.
> The problem is that in the definition of a given element, I have both:
>
> * a (sub)element named 'foo' in a sequence
> * and an attribute also named 'foo';
>
> Running xjc, I get an error saying: Property "Foo" is already defined.
> Is this an xjc bug? For me, the file Foo.java should be created for the
> (sub)element only, the attribute is just a local string.
> Is there any workaround, perhaps by using some customizing instruction
> (which I'm not at all familiar with)?

See
http://weblogs.java.net/blog/kohsuke/archive/2005/05/compiling_mathm_1.html

Or try
http://weblogs.java.net/blog/kohsuke/archive/2006/03/simple_and_bett.html
  to let XJC resolve those automatically.

-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com