Hi Damien,
Can you file this as a bug (http://bugzilla.exolab.org). Castor is
probably not handling the extension correctly when simpleContent is
involved. It's probably an issue with the default
XMLClassDescriptorImpl.
--Keith
Damien GAUTIER-DE-LAHAUT wrote:
>
> Hello,
>
> When unmarshalling an xml file I get the following exception :
> -------------------------------------------------------------
> org.xml.sax.SAXException: unable to add text content to CTOT due to the
> following error: java.lang.IllegalStateException:
> java.lang.ClassCastException{file: ; line: 43; column: 98}
>
> The line in question is :
> ------------------------
>
> <CTOT Source="Damien"
> ModificationTime="14:20:00.456">11:08:06.123</CTOT>
>
> with column 98 is just after the last character of this line
>
> The type of this Element is complex :
> -----------------------------------
>
> the content of the element is an xsd:time
> and the element has 2 attributes, one is string and the other is of type
> xsd:time.
>
> <xsd:element name="CTOT" type="CDMTimeType" minOccurs="0"/>
>
> <xsd:complexType name="CDMTimeType">
> <xsd:simpleContent>
> <xsd:extension base="xsd:time">
> <xsd:attribute name="Source" type="xsd:string"
> use="optional"/>
> <xsd:attribute name="ModificationTime" type="xsd:time"
> use="optional"/>
> </xsd:extension>
> </xsd:simpleContent>
> </xsd:complexType>
>
> Some comment :
> ------------
>
> When I suppress the content, and consequently it remains
>
> <CTOT Source="Damien" ModificationTime="14:20:00.456"></CTOT>
>
> it unmarshalls correctly (and when I marshall and print the result, I
> get exactly my original file, excellent)
>
> Then I set the value Programmally :
>
> org.exolab.castor.types.Time tm = new
> org.exolab.castor.types.Time("11:08:06.123");
> ....getCTOT().setContent(tm);
>
> It works and then, on the output I then get :
>
> <CTOT Source="Damien"
> ModificationTime="14:20:00.456">11:08:06.123</CTOT>
>
> And this is precisely what I tried to parse at the begining but it
> produced exception.
>
> Can someone help me to understand this problem.
>
> I thank you a lot
>
> Damien Gautier de Lahaut
>
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
> unsubscribe castor-dev
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev