users@jaxb.java.net

Error occurs when converting XML schema to Java objects

From: Peizhao Hu <peizhao_at_itee.uq.edu.au>
Date: Wed, 28 Feb 2007 00:47:30 +1000

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>

-- 
regards;
Peizhao