users@jaxb.java.net

Re: Unique Particle Attribution

From: Joe Fialli <joseph.fialli_at_sun.com>
Date: Wed, 12 Feb 2003 16:20:25 -0500

Sean Rohead wrote:
> I have a schema that is generating this error. I saw another post about this, but it related to a case where an element and a complex type had the same name. This is not exactly what I'm doing so I thought I'd ask if this is something that I can create a customization for or whether it is actually a bug in the RI.
>
> My goal is to create a schema where a <filer> can contain a <name> or a <ssn> or both (but it must have at least one of them). I couldn't figure out any other way to express this than:
>
> <filer> = <name> | <ssn> | <name> <ssn>
>
> So, the schema looks something like this:
>
> <xs:complexType name="FilerType">
> <xs:sequence>
> <xs:choice>
> <xs:element ref="name"/>
> <xs:element ref="ssn"/>
> <xs:sequence>
> <xs:element ref="name"/>
> <xs:element ref="ssn"/>
> </xs:sequence>
> </xs:choice>
> <xs:element name="address" type="AddressType"/>
> </xs:sequence>
> </xs:complexType>
>
> This is causing the following error when I run xjc:
>
> cos-nonambig: "":name and "":name (or elements from their substitution group) violate "Unique Particle Attribution".
> line 20 of DiscoverBankruptcy.xsd
>
>
> Is there anything I can do to avoid this error? Is this something is behaving as specified or is it going to be fixed in the FCS?
>
>

The situation is described by the following link into XML Schema Part 1
specification.

http://www.w3.org/TR/xmlschema-1/#cos-nonambig

To summarize, the error above is reporting that one would need lookahead to
determine which choice particle is constraining a document. It is
ambiguous between element ref="name particle and the sequence that
begins with element ref="name".


-Joe Fialli, Sun Microsystems

> Thank you very much,
>
> Sean Rohead


--