In my schema, I want an element which has type xs:date, plus the extension
of an attribute to the element. 

I'm getting ClassCast Exceptions thrown when I unmarshal from xml - the
sourcegen code can't seem to deal with the date as a string in the XML.

Schema:

<xsd:element name="mydate" >
<xsd:complexType>
<xsd:simpleContent>
 <xsd:extension base="xsd:date" >
        <xsd:attribute name="prec" type="xsd:string" />
 </xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
</xsd:element>

This looks pretty similar to a problem reported a while back by Jonathan
Weir  last September

http://www.mail-archive.com/[email protected]/msg08777.html

I'm using a 0.9.4.2 CVS daily snapshot from around the 31st Jan

If this is going to be a big problem to fix I'll re-jig my schema to avoid
extending the date element.


Tim Fulcher


The exception reads - 

C:\Documents and Settings\fulchetr.AQUA\My Documents\castor>jython
..\testcastor.py
marshal req date to 
<?xml version="1.0" encoding="UTF-8"?>
<bucket>
    <mydate prec="absolute">2003-02-07</mydate>
    <myint>33</myint>
</bucket>

unmarshal from xml
Traceback (innermost last):
  File "..\testcastor.py", line 44, in ?
org.xml.sax.SAXException: unable to add text content to mydate due to the
following error: java.lang.IllegalStateException:
java.lang.ClassCastException: java.lang.String
        at
org.exolab.castor.xml.UnmarshalHandler.endElement(UnmarshalHandler.java:655)
        at
org.apache.xerces.parsers.AbstractSAXParser.endElement(AbstractSAXParser.jav
a:577)
        at
org.apache.xerces.impl.XMLNamespaceBinder.endElement(XMLNamespaceBinder.java
:647)
        at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocu
mentFragmentScannerImpl.java:1008)
        at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatc
her.dispatch(XMLDocumentFragmentScannerImpl.java:1469)
        at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocume
ntFragmentScannerImpl.java:329)
        at
org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:525)
        at
org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:581)
        at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:152)
        at
org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:117
5)
        at
org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:555)
        at
org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:487)
        at
org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:627)
        at mydate.Bucket.unmarshalBucket(Bucket.java:160)

org.exolab.castor.xml.MarshalException: org.xml.sax.SAXException: unable to
add
text content to mydate due to the following error:
java.lang.IllegalStateException: java.lang.ClassCastException:
java.lang.String{file: [not available]; line:3; column: 48}
C:\Documents and Settings\fulchetr.AQUA\My Documents\castor>

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to