users@jaxb.java.net

Re: follow-up GML conflicting when binding SensorML schema

From: Hank Ratzesberger <hankr_at_crustal.ucsb.edu>
Date: Wed, 18 Apr 2007 08:09:31 -0700

Peizhao,

We don't need to change the schema, only annotate it.
Or possibly, a single binding in the .xjb file might
do the job.

Probably not, so its only a matter of annotating the
schema at these places with a <jaxb:property name="AbsElementName"/>
for example to direct the parser around the conflict.

--Hank

----- Original Message -----
From: "Peizhao Hu" <peizhao_at_itee.uq.edu.au>
To: <users_at_jaxb.dev.java.net>
Sent: Wednesday, April 18, 2007 7:57 AM
Subject: Re: follow-up GML conflicting when binding SensorML schema


> Hi,
>
> I understand the problem now.
>
> Abstract elements are declared in GML as "_ElementName", concrete elements as "ElementName".
> As a Java class name can not start with '_', the binding compiler mapps the name of the abstract
> element "_ElementName" to "ElementName". Therefore, there will be a collision when the concrete
> element is also bound to a class named "ElementName".
>
> so how do I use XSLT to transform all abstract elements into some thing
> different?
>
> regards;
>
> Peizhao
>
>
>
> Peizhao Hu wrote:
>> Hi,
>>
>> regarding to these errors:
>> phu_at_phu-mac:~/programming/SensorML_examples/SensorMLV1.0/sweCommon/1.0.0
>> $ xjc.sh positionTypes.xsd
>> parsing a schema...
>> compiling a schema...
>> [ERROR] Two declarations cause a collision in the ObjectFactory class.
>> line 1462 of
>> http://schemas.opengis.net/gml/3.1.1/base/geometryPrimitives.xsd
>>
>> [ERROR] (Related to above error) This is the other declaration.
>> line 1516 of
>> http://schemas.opengis.net/gml/3.1.1/base/geometryPrimitives.xsd
>>
>> [ERROR] Two declarations cause a collision in the ObjectFactory class.
>> line 201 of http://schemas.opengis.net/gml/3.1.1/base/defaultStyle.xsd
>>
>> [ERROR] (Related to above error) This is the other declaration.
>> line 220 of http://schemas.opengis.net/gml/3.1.1/base/defaultStyle.xsd
>>
>> [ERROR] Two declarations cause a collision in the ObjectFactory class.
>> line 283 of
>> http://schemas.opengis.net/gml/3.1.1/base/geometryBasic0d1d.xsd
>>
>> [ERROR] (Related to above error) This is the other declaration.
>> line 13 of
>> http://schemas.opengis.net/gml/3.1.1/base/geometryPrimitives.xsd
>>
>> [ERROR] Two declarations cause a collision in the ObjectFactory class.
>> line 36 of http://schemas.opengis.net/gml/3.1.1/base/defaultStyle.xsd
>>
>> [ERROR] (Related to above error) This is the other declaration.
>> line 51 of http://schemas.opengis.net/gml/3.1.1/base/defaultStyle.xsd
>>
>> [ERROR] Two declarations cause a collision in the ObjectFactory class.
>> line 169 of http://schemas.opengis.net/gml/3.1.1/base/defaultStyle.xsd
>>
>> [ERROR] (Related to above error) This is the other declaration.
>> line 150 of http://schemas.opengis.net/gml/3.1.1/base/defaultStyle.xsd
>>
>> [ERROR] Two declarations cause a collision in the ObjectFactory class.
>> line 293 of http://schemas.opengis.net/gml/3.1.1/base/defaultStyle.xsd
>>
>> [ERROR] (Related to above error) This is the other declaration.
>> line 312 of http://schemas.opengis.net/gml/3.1.1/base/defaultStyle.xsd
>>
>> [ERROR] Two declarations cause a collision in the ObjectFactory class.
>> line 73 of http://schemas.opengis.net/gml/3.1.1/base/defaultStyle.xsd
>>
>> [ERROR] (Related to above error) This is the other declaration.
>> line 92 of http://schemas.opengis.net/gml/3.1.1/base/defaultStyle.xsd
>>
>> [ERROR] Two declarations cause a collision in the ObjectFactory class.
>> line 86 of
>> http://schemas.opengis.net/gml/3.1.1/base/geometryBasic2d.xsd
>>
>> [ERROR] (Related to above error) This is the other declaration.
>> line 1084 of
>> http://schemas.opengis.net/gml/3.1.1/base/geometryPrimitives.xsd
>>
>> [ERROR] Two declarations cause a collision in the ObjectFactory class.
>> line 95 of http://schemas.opengis.net/gml/3.1.1/base/feature.xsd
>>
>> [ERROR] (Related to above error) This is the other declaration.
>> line 111 of http://schemas.opengis.net/gml/3.1.1/base/feature.xsd
>>
>> [ERROR] Two declarations cause a collision in the ObjectFactory class.
>> line 921 of
>> http://schemas.opengis.net/gml/3.1.1/base/geometryPrimitives.xsd
>>
>> [ERROR] (Related to above error) This is the other declaration.
>> line 14 of
>> http://schemas.opengis.net/gml/3.1.1/base/geometryBasic2d.xsd
>>
>> [ERROR] Two declarations cause a collision in the ObjectFactory class.
>> line 252 of http://schemas.opengis.net/gml/3.1.1/base/defaultStyle.xsd
>>
>> [ERROR] (Related to above error) This is the other declaration.
>> line 271 of http://schemas.opengis.net/gml/3.1.1/base/defaultStyle.xsd
>>
>> Failed to produce code.
>> phu_at_phu-mac:~/programming/SensorML_examples/SensorMLV1.0/sweCommon/1.0.0
>> $
>>
>>
>> I have a few questions and hope someone can ask some of them.
>> 1. what do "Two declarations cause a collision in the ObjectFactory
>> class" and "(Related to above error) This is the other declaration."
>> mean?
>> 2. do they really mean name collision with XML elements? I suspect
>> these errors occur whenever there is a substitutionGroup, like
>> <element name="_Solid" type="gml:AbstractSolidType" abstract="true"
>> substitutionGroup="gml:_GeometricPrimitive">
>>
>>
>>
>> Comments about the error from SensorML community:
>>
>> I believe these are related to JAXB getting confused be declarations of
>> XML elements whose name differs only by lexical case. XML names are
>> case-sensitive (this is specifically stated in the *XML* spec from W3C).
>> You have to configure your data binding environment to respect this.
>>
>>
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>