Hi, all
When I build Java files from defiend schema using Castor, it works well If the element is simple or complex without extension. But if the schema contains some complexContent and extension or choice, castor can generate Java files successifully and corresponding Java class also can be created by compiler. However, an exception is raised during an unmarshal execution.
For example,
For example,
<xsd:complexType name="asciiFrameTypes">
<xsd:complexContent>
<xsd:extension base="variableFrameTypes">
<xsd:sequence>
<xsd:complexContent>
<xsd:extension base="variableFrameTypes">
<xsd:sequence>
<xsd:element name="FieldDelimiter" type="delimiterType"/>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="SensorFieldGroup" type="baseSensorGroupTypes"/>
<xsd:element name="SensorCountField" type="baseSensorFieldTypes"/>
</xsd:choice>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="SensorFieldGroup" type="baseSensorGroupTypes"/>
<xsd:element name="SensorCountField" type="baseSensorFieldTypes"/>
</xsd:choice>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="baseSensorFieldTypes" abstract="true">
<xsd:complexContent>
<xsd:extension base="baseFieldTypes">
<xsd:sequence>
<xsd:element name="Identifier" type="IdentifierType"/>
<xsd:element name="Sequence" type="SequenceType"/>
<xsd:element name="Units" type="SensorUnits" minOccurs="0"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexContent>
<xsd:extension base="baseFieldTypes">
<xsd:sequence>
<xsd:element name="Identifier" type="IdentifierType"/>
<xsd:element name="Sequence" type="SequenceType"/>
<xsd:element name="Units" type="SensorUnits" minOccurs="0"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="baseFieldTypes" abstract="true">
<xsd:sequence>
<xsd:element name="Name" type="nonEmptyToken"/>
<xsd:element name="Description" minOccurs="0" type="nonEmptyToken"/>
</xsd:sequence>
</xsd:complexType>
<xsd:sequence>
<xsd:element name="Name" type="nonEmptyToken"/>
<xsd:element name="Description" minOccurs="0" type="nonEmptyToken"/>
</xsd:sequence>
</xsd:complexType>
I created binding xml file like the following:
<cbf:complexTypeBinding name="asciiFrameTypes">
<cbf:java-class name="VarAsciiFrameTypes"/>
<cbf:elementBinding name="FieldDelimiter">
<cbf:member name="VAFFieldDelimiter" type="delimiterType"/>
</cbf:elementBinding>
<cbf:elementBinding name="SensorFieldGroup">
<cbf:member name="VAFSensorFieldGroup" type="varAsciiSensorGroupTypes "/>
</cbf:elementBinding>
<cbf:elementBinding name="SensorCountField">
<cbf:member name="VAFSensorCountField" type="xsd:string"/>
</cbf:elementBinding>
</cbf:complexTypeBinding>
<cbf:java-class name="VarAsciiFrameTypes"/>
<cbf:elementBinding name="FieldDelimiter">
<cbf:member name="VAFFieldDelimiter" type="delimiterType"/>
</cbf:elementBinding>
<cbf:elementBinding name="SensorFieldGroup">
<cbf:member name="VAFSensorFieldGroup" type="varAsciiSensorGroupTypes "/>
</cbf:elementBinding>
<cbf:elementBinding name="SensorCountField">
<cbf:member name="VAFSensorCountField" type="xsd:string"/>
</cbf:elementBinding>
</cbf:complexTypeBinding>
<cbf:complexTypeBinding name="baseFieldTypes">
<cbf:java-class name="BaseFieldTypes" abstract="true"/
<cbf:elementBinding name="Name">
<cbf:member name="BFDName" type="nonEmptyToken"/>
</cbf:elementBinding>
<cbf:elementBinding name="Description">
<cbf:member name="BFDDescription" minOccurs="0" type="nonEmptyToken"/>
</cbf:elementBinding>
</cbf:complexTypeBinding>
<cbf:elementBinding name="Name">
<cbf:member name="BFDName" type="nonEmptyToken"/>
</cbf:elementBinding>
<cbf:elementBinding name="Description">
<cbf:member name="BFDDescription" minOccurs="0" type="nonEmptyToken"/>
</cbf:elementBinding>
</cbf:complexTypeBinding>
<cbf:complexTypeBinding name="baseSensorFieldTypes">
<cbf:java-class name="BaseSensorFieldTypes" abstract="true"/>
<cbf:elementBinding name="Identifier">
<cbf:member name="BSFIdentifier" type="nonEmptyToken"/>
</cbf:elementBinding>
<cbf:elementBinding name="Sequence">
<cbf:member name="BSFSequence" type="xsd:positiveInteger"/>
</cbf:elementBinding>
<cbf:elementBinding name="Units">
<cbf:member name="BSFUnits" type="SensorUnits" minOccurs="0"/>
</cbf:elementBinding>
</cbf:complexTypeBinding>
<cbf:java-class name="BaseSensorFieldTypes" abstract="true"/>
<cbf:elementBinding name="Identifier">
<cbf:member name="BSFIdentifier" type="nonEmptyToken"/>
</cbf:elementBinding>
<cbf:elementBinding name="Sequence">
<cbf:member name="BSFSequence" type="xsd:positiveInteger"/>
</cbf:elementBinding>
<cbf:elementBinding name="Units">
<cbf:member name="BSFUnits" type="SensorUnits" minOccurs="0"/>
</cbf:elementBinding>
</cbf:complexTypeBinding>
the xml data like this:
<asciiFrame>
....
<SensorFieldGroup>
<Name>TILT</Name>
<Identifier>TILT</Identifier>
<Sequence>1</Sequence>
<Units>degree</Units>
<IsUseable>true</IsUseable>
</SensorFieldGroup>
<Name>TILT</Name>
<Identifier>TILT</Identifier>
<Sequence>1</Sequence>
<Units>degree</Units>
<IsUseable>true</IsUseable>
</SensorFieldGroup>
</asciiFrame>
the error means that the "Name" is not a field of SensorCountField class.
Any help will be appreciated
thanks

