Hi John, Your fix is ok, I committed it in CVS. Thanks for providing it. Arnaud
> -----Original Message----- > From: John Weir [mailto:[EMAIL PROTECTED] > Sent: Sunday, February 23, 2003 11:10 PM > To: [EMAIL PROTECTED] > Subject: Re: [castor-dev] Parsing exception of a xsd:Time > > Damien / Keith, > > I had a similar problem, specifically with Date processing. I had a type > that extended date to add an ID Attribute and it failed to unmarshall. > > I have attached the diff -u output for your perusal. This worked for me. > > Hope it helps > > John > > > > Index: DescriptorSourceFactory.java > =================================================================== > RCS file: > /cvs/castor/castor/src/main/org/exolab/castor/builder/DescriptorSource > Factory.java,v > retrieving revision 1.91 > diff -u -r1.91 DescriptorSourceFactory.java > > @@ -394,6 +394,9 @@ > boolean isAttribute = > (member.getNodeType() == FieldInfo.ATTRIBUTE_TYPE); > > + boolean isText = > + (member.getNodeType() == FieldInfo.TEXT_TYPE); > + > if (xsType.getType() == XSType.CLASS) > isEnumerated = ((XSClass) xsType).isEnumerated(); > > @@ -485,7 +490,7 @@ > //i.e add specific FieldHandler in > org.exolab.castor.xml > .handlers > //dateTime is not concerned by the following since > it is > directly > //handle by DateFieldHandler > - if (isAttribute > + if ((isAttribute || isText) > && xsType.isDateTime() > && xsType.getType() != xsType.DATETIME_TYPE) > { > jsc.append(".parse"); > > > -----Original Message----- > > From: Keith Visco [mailto:[EMAIL PROTECTED] > > Sent: 21 February 2003 21:53 > > To: [EMAIL PROTECTED] > > Subject: Re: [castor-dev] Parsing exception of a xsd:Time > > > > > > > > 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 > > > > > > ----------------------------------------------------------- > 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
