Hi,
I face the problem that when I unmarshall an element whose type is
"xsd:string" with a
restriction to enumerated values Castor inserts some "xsi" attributes for
this element.
On the other hand everything seems to be fine for attributes of the same
type.
This occurs using classes generated by the SourceGenerator (CVS snapshot
Nov 14th) and JDK 1.2.2.
Here is my schema and the output of CASTOR marshalling of a tree of Java
objects -
note that when I try to unmarshal the output of marshal() I get an error
because of the
xsi stuff ! :
----------------------------------------------------------------------------
---------------------
<?xml version = "1.0" encoding = "UTF-8"?>
<xsd:schema
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:msg="http://www.bednarik.com/test"
xmlns="http://www.bednarik.com/test"
targetNamespace="http://www.bednarik.com/test"
elementFormDefault="unqualified" >
<xsd:element name="Main">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="EnumeratedElement" />
<xsd:element ref="ElementWithEnumeratedAttribute" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="EnumeratedElement" >
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="yes" />
<xsd:enumeration value="no" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="ElementWithEnumeratedAttribute" >
<xsd:complexType>
<xsd:attribute name="flag">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="yes" />
<xsd:enumeration value="no" />
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
----------------------------------------------------------------------------
---------------------
<?xml version="1.0"?>
<test:Main xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:test="http://www.bednarik.com/test">
<test:EnumeratedElement
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="java:java.lang.String">yes</test:EnumeratedElement>
<test:ElementWithEnumeratedAttribute flag="no"/>
</test:Main>
----------------------------------------------------------------------------
---------------------
Error from unmarshal():
org.xml.sax.SAXException: unable to instantiate java.lang.String;
org.xml.sax.SA
XException: class java.lang.String is not a subclass of class
com.hp.es.xml.test
.types.EnumeratedElementType
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev