Dear Keith Visco:
 
This is the third time I post the message.
 
I am in great trouble.
 
I have described the problem in details in last two times.
 
=================== Last time message ==============
:::
 
has castor-xml implemented the complex type's extension functionality in the marshall/unmarshall framework?
the source generator remarkably did this.
 
that is: we have xsd (partial)
<xs:complexType name="SubType">
    <xs:complexContent>
        <xs:extension base="SuperType">
            <xs:sequence>
                <xs:element name="rootElement" type="xs:string"/>
            </xs:sequence>
        </xs:extension>
    </xs:complexContent>
</xs:complexType>
 
<xs:complexType name="SuperType">
    <xs:attribute name="id" type="xs:string" />
</xs:complexType>
 
then we unmarshall from xml:
 
<SuperType id="2" xsi:type="SubType">
    <rootElement>order</rootElement>
</SuperType>
 
in the current cvs version of castor-xml.
we cannot cast the got object from SuperType to SubType.
I think that is want we want to do by design.
 
When I unmarshalled using the generated descriptors. I got the following exception:
org.xml.sax.SAXException: unable to find FieldDescriptor for 'rootElement' in ClassDescriptor of SuperType.
        at org.exolab.castor.xml.UnmarshalHandler.startElement(UnmarshalHandler.java:815)
        at org.apache.xerces.parsers.SAXParser.startElement(SAXParser.java:1340)
        at org.apache.xerces.validators.common.XMLValidator.callStartElement(XMLValidator.java:1197)
        at org.apache.xerces.framework.XMLDocumentScanner.scanElement(XMLDocumentScanner.java:1862)
        at org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1238)
        at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381)
        at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1035)
...
 
I am anxiously waiting for the help.
e.g. how can i modify the generated descriptor to solve this problem.....
=================================
 
This time I attached the files I used in my test.
 
please help

<<attachment: cp.bat>>

<<attachment: genType.bat>>

<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XML Spy v4.1 U (http://www.xmlspy.com) by chengyi (braveminds) -->
<Sub xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:noNamespaceSchemaLocation="D:\project\platform\src\bmwf\src\bin\test.xsd" id="1" xsi:type="SubType">
	<rootElement>root</rootElement>
</Sub>
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XML Spy v4.1 U (http://www.xmlspy.com) by chengyi (braveminds) -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"; elementFormDefault="qualified" attributeFormDefault="unqualified">
	<xs:complexType name="SubType">
		<xs:complexContent>
			<xs:extension base="SuperType">
				<xs:sequence>
					<xs:element name="rootElement" type="xs:string"/>
				</xs:sequence>
			</xs:extension>
		</xs:complexContent>
	</xs:complexType>
	<xs:complexType name="SuperType">
		<xs:attribute name="id" type="xs:string"/>
	</xs:complexType>
	<xs:element name="Sub" type="SuperType"/>
</xs:schema>

<<attachment: testMarshal.bat>>


Attachment: TestMarshall.java
Description: JavaScript source

Reply via email to