users@jaxb.java.net

Re: Errors running xjc

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Thu, 09 Mar 2006 16:57:19 -0800

(I'm having hard time reading your reply as it's not clear what is
quoted and what's not.)

If those two "name" elements belong to a different target namespace, and
still it's causing a collision on ObjectFactory, then the issue must be
that you are generating all those namespaces into a single Java package.
Use multiple different Java packages to avoid a collision. To do this
you should use <jaxb:schemaBindings>.

Enrique Andreu wrote:
> Hello, I tried to compile
> http://schemas.opengis.net/wcs/1.0.0/wcsCapabilities.xsd with the -nv option
> and the errors were this (at the end of the paragraph I describe the use of
> a external customization file but with the same result) :
>> > [ERROR] Two declarations cause a collision in the ObjectFactory
>> > class.line 46 of http://schemas.opengis.net/wcs/1.0.0/owsBase.xsd
>> > [ERROR] (Related to above error) This is the other declaration.line
> 63
>> > of http://schemas.opengis.net/wcs/1.0.0/gml4wcs.xsd
>> >
>> > http://schemas.opengis.net/wcs/1.0.0/owsBase.xsd is an include and
>> > http://schemas.opengis.net/wcs/1.0.0/gml4wcs.xsd is an import.
>> > owsBase.xsd has the same targetnamespace than wcsCapabilities.xsd and
>> > gml4wcs.xsd has a different targetnamespace.
>> > In owsBase.xsd at line 46 is:
>> > <xs:element name="name" type="xs:string"></xs:element>
>> > In gml4wcs.xsd at line 63 is:
>> > <element name="name" type="gml:CodeType"></element>
>> >
>> > I try to run xjc with this external customization file, but I obtain the
>> > same error.
>> > <jxb:bindings version="1.0" xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
>> > xmlns:xs="http://www.w3.org/2001/XMLSchema">
>> > <jxb:bindings
>> > schemaLocation="http://schemas.opengis.net/wcs/1.0.0/gml4wcs.xsd">
>> > <jxb:bindings node="//xs:element[@name='name']">
>> > <jxb:property name="gml_description"/>
>> > </jxb:bindings>
>> > </jxb:bindings>
>> > </jxb:bindings>
>
> Thanks:
> Enrique Andreu
>
>
> ----- Original Message -----
> From: "Kohsuke Kawaguchi" <Kohsuke.Kawaguchi_at_Sun.COM>
> To: <users_at_jaxb.dev.java.net>
> Sent: Tuesday, February 28, 2006 7:29 PM
> Subject: Re: Errors running xjc
>
>
>>
>> This is really a bug in the GML schema. The error is saying that it
>> violates some arcane parts of the XML Schema spec.
>>
>> The best thing to do is to tell the schema author to fix it. I'm pretty
>> sure they already know about this, as you weren't the first one to hit
>> this problem.
>>
>> Meanwhile, try "-nv" option, which makes JAXB look the other way for
>> these issues.
>>
>>
>> Enrique Andreu wrote:
>> > Hello, I try to use jaxb with
>> > http://schemas.opengis.net/wcs/1.0.0/wcsCapabilities.xsd but I obtain
> this
>> > erros when I use the binding compiler xjc:
>> > [ERROR] rcase-Recurse.2: There is not a complete functional mapping
>> > between the particles. line 355 of file:....
>> > [ERROR] derivation-ok-restriction.5.4.2: Error for type
>> > 'AbstractDescriptionBase Type'. The particle of the type is not a valid
>> > restriction of the particle of the base.line 355 of file:....
>> > Failed to parse a schema.
>> >
>> > The line 355 of the file is:
>> > <xs:complexType name="AbstractDescriptionBaseType" abstract="true">
>> > <xs:complexContent>
>> > <xs:restriction base="gml:AbstractGMLType">
>> > <xs:sequence>
>> > <xs:element ref="metadataLink" minOccurs="0"
>> > maxOccurs="unbounded"/>
>> > </xs:sequence>
>> > </xs:restriction>
>> > </xs:complexContent>
>> > </xs:complexType>
>> >
>> > gml:AbstractGMLType is also abstract.
>> >
>> >
>> > The errors may be due to a validation error, so if I run xjc with
> the -nv
>> > option the errors are:
>> > [ERROR] Two declarations cause a collision in the ObjectFactory
>> > class.line 46 of http://schemas.opengis.net/wcs/1.0.0/owsBase.xsd
>> > [ERROR] (Related to above error) This is the other declaration.line
> 63
>> > of http://schemas.opengis.net/wcs/1.0.0/gml4wcs.xsd
>> >
>> > http://schemas.opengis.net/wcs/1.0.0/owsBase.xsd is an include and
>> > http://schemas.opengis.net/wcs/1.0.0/gml4wcs.xsd is an import.
>> > owsBase.xsd has the same targetnamespace than wcsCapabilities.xsd and
>> > gml4wcs.xsd has a different targetnamespace.
>> > In owsBase.xsd at line 46 is:
>> > <xs:element name="name" type="xs:string"></xs:element>
>> > In gml4wcs.xsd at line 63 is:
>> > <element name="name" type="gml:CodeType"></element>
>> >
>> > I try to run xjc with this external customization file, but I obtain the
>> > same error.
>> > <jxb:bindings version="1.0" xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
>> > xmlns:xs="http://www.w3.org/2001/XMLSchema">
>> > <jxb:bindings
>> > schemaLocation="http://schemas.opengis.net/wcs/1.0.0/gml4wcs.xsd">
>> > <jxb:bindings node="//xs:element[@name='name']">
>> > <jxb:property name="gml_description"/>
>> > </jxb:bindings>
>> > </jxb:bindings>
>> > </jxb:bindings>
>> >
>> > Someone can help me, please.
>> >
>> > Thank:
>> > Enrique Andreu
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
>> > For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>> >
>> >
>>
>>
>> --
>> Kohsuke Kawaguchi
>> Sun Microsystems kohsuke.kawaguchi_at_sun.com
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>


-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com