Hi,

I am a beginner in Castor, XML and XSD

I'm tryng to unmarshall that kind of XML file

<ListeData>
<Data xsi:type="AType">
<Comments></Comments>
<Distance>100</Distance>
</Data>
<Data xsi:type="BType">
<Comments></Comments>
<Speed>100.0</Speed>
</Data>
</ListeData>


For that, i wrote an xsd file and generated the code through Castor

During the unmarshalling process a cast exception is raised, and in the
following example an attempt of a cast from Data to AType is being made.


Have you got an idea how to deal with that?

Thanks for any clue you may give!!

<!-- Type DATA_TYPE -->
<xsd:element name="ListData" type="ListDataType"/> 

<xsd:complexType name="ListDataType">
<xsd:sequence>
<xsd:element name="Data" type="CoreType" minOccurs="0"
maxOccurs="unbounded"/> 
</xsd:sequence>
</xsd:complexType>

<xsd:complexType name="CoreType">
<xsd:complexContent>
<xsd:sequence>
<xsd:element name="Comments" type="xsd:string"/>
</xsd:sequence>
</xsd:complexContent>
</xsd:complexType>


<xsd:complexType name="AType">
<xsd:complexContent>
<xsd:extension base="CoreType">
<xsd:sequence>
<xsd:element name="Distance" type="xsd:int"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>

<xsd:complexType name="BType">
<xsd:complexContent>
<xsd:extension base="CoreType">
<xsd:sequence>
<xsd:element name="Speed" type="xsd:double"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
-- 
View this message in context: 
http://www.nabble.com/Cast-Error-and-xsi%3Atype-tf3454026.html#a9635346
Sent from the Castor - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to