dev@jaxb.java.net

Re: Error occurs when converting XML schema to Java objects

From: Peizhao Hu <peizhao_at_itee.uq.edu.au>
Date: Fri, 02 Mar 2007 11:53:00 +1000

Hi

well, you are right in my example schema, the whole set of schema is
from upcoming SensorML standard. you can download the whole set from
http://vast.uah.edu/SensorML/schema/sensorML_2006-05-09.zip
the problem occurs when mapping the process.xsd under
sensorML/1.0.30/base. it referred to parameter.xsd SubstitutionGroups as
described.
As sensorml is becoming more and more popular, I guess there would be
more people try to map the schema to Java objects.

many thanks

regards;

Peizhao



Kohsuke Kawaguchi wrote:
>
> Your schema fragment didn't compile because I don't have two types
> referenced from there, so I modified it as follows, and that compiled
> just fine.
>
> So I think if you still see this problem you should file an issue with
> a complete schema as an attachment.
>
>
> modified schema:
>
> <xs:schema targetNamespace="http://www.opengis.net/swe"
> xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
> xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
> jaxb:extensionBindingPrefixes="xjc"
> xmlns:xlink="http://www.w3.org/1999/xlink"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:swe="http://www.opengis.net/swe"
> elementFormDefault="qualified"
> attributeFormDefault="unqualified"
> jaxb:version="2.1" >
>
>
> <!--============================-->
>
> <!-- Main Substitution Groups -->
>
> <!--============================-->
>
> <xs:element name="_DataGroup" type="xs:anyType" abstract="true">
> <xs:annotation>
> <xs:appinfo>
> <xjc:substitutable />
> </xs:appinfo>
> </xs:annotation>
> </xs:element>
>
> <xs:element name="_DataArray" type="xs:anyType" abstract="true">
> <xs:annotation>
> <xs:appinfo>
> <xjc:substitutable />
> </xs:appinfo>
> </xs:annotation>
> </xs:element>
> </xs:schema>
>
>
> Peizhao Hu wrote:
>> Hi,
>>
>> I tried to use JAXB RI 2.1.2 to bind a set of xml schema. however, It
>> failed when binding "substitutionGroup", I have modified the schema
>> with customisation annotations as shown below, however, it still
>> generate errors. I searched on google for this errors, but no luck.
>> do you have any idea?
>>
>>
>> //====================== Error ===================
>> SensorML_examples/schemas/sweCommon/1.0.30$ xjc.sh parameters.xsd
>> -extension
>> parsing a schema...
>> [ERROR] compiler was unable to honor this substitutable
>> customization. It is attached to a wrong place, or its inconsistent
>> with other bindings.
>> line 26 of
>> file:/home/phu/programming/SensorML_examples/schemas/sweCommon/1.0.30/parameters.xsd
>>
>>
>> [ERROR] (the above customization is attached to the following
>> location in the schema)
>> line 23 of
>> file:/home/phu/programming/SensorML_examples/schemas/sweCommon/1.0.30/parameters.xsd
>>
>>
>> [ERROR] compiler was unable to honor this substitutable
>> customization. It is attached to a wrong place, or its inconsistent
>> with other bindings.
>> line 33 of
>> file:/home/phu/programming/SensorML_examples/schemas/sweCommon/1.0.30/parameters.xsd
>>
>>
>> [ERROR] (the above customization is attached to the following
>> location in the schema)
>> line 30 of
>> file:/home/phu/programming/SensorML_examples/schemas/sweCommon/1.0.30/parameters.xsd
>>
>>
>> Failed to parse a schema.
>>
>>
>>
>>
>> //====================== schema ===================
>> <xs:schema targetNamespace="http://www.opengis.net/swe"
>> xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
>> xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
>> jaxb:extensionBindingPrefixes="xjc"
>> xmlns:xlink="http://www.w3.org/1999/xlink"
>> xmlns:xs="http://www.w3.org/2001/XMLSchema"
>> xmlns:swe="http://www.opengis.net/swe"
>> elementFormDefault="qualified"
>> attributeFormDefault="unqualified"
>> jaxb:version="2.1" >
>>
>>
>> <!--============================-->
>>
>> <!-- Main Substitution Groups -->
>>
>> <!--============================-->
>>
>> <xs:element name="_DataGroup" type="swe:_GroupBaseType"
>> abstract="true">
>> <xs:annotation>
>> <xs:appinfo>
>> <xjc:substitutable />
>> </xs:appinfo>
>> </xs:annotation>
>> </xs:element>
>> <xs:element name="_DataArray" type="swe:_ArrayBaseType"
>> abstract="true">
>> <xs:annotation>
>> <xs:appinfo>
>> <xjc:substitutable />
>> </xs:appinfo>
>> </xs:annotation>
>> </xs:element>
>>
>
>