I have two XSDs fruit.xsd (tns=http://www.xyz.com/fruit) and
apple.xsd(tns=http://www.xyz.com/fruit) as below
AppleType defined in apple.xsd references complexType "nutritionInfoType" and
simpleType enumeration "stateType" defined in fruit.xsd
Similarly FruitType defined in fruit.xsd also references complexType
"nutritionInfoType" and simpleType enumeration "stateType".
The source generator builds the bindings for the two xsds in seperate folders based on
the castorbuilder.properties below.
fruit.xsd is compiled into com.xyz.fruit.binding
apple.xsd is complied into com.xyz.fruit.apple.binding
The source generator generates the right getters and setters for
com.xyz.fruit.binding.FruitType i.e
public com.xyz.fruit.binding.NutritionInfoType getNutritionInfo()
public com.xyz.fruit.binding.types.StateType getState()
but for com.xyz.fruit.apple.binding.AppleType the getters and setters are inconsistent
from the ones above.
public com.xyz.fruit.binding.NutritionInfoType getNutritionInfo()
public java.lang.String getState()
The type for the complexTypes(NutritionInfoType) works correctly, but why are getters
and setter for the enumeration based on String?
Is this desired behavior? Why this inconsistency between complexTypes and SimpleTypes?
I did a fresh checkout from cvs and tried this example.
Any help is much appreciated.
Thanks,
Abhideep
castorbuilder.properties
============================
org.exolab.castor.builder.javaclassmapping=type
org.exolab.castor.builder.nspackages=\
http://www.xyz.com/fruit=com.xyz.fruit.binding,\
http://www.xyz.com/apple=com.xyz.fruit.apple.binding
fruit.xsd
==============================
<?xml version="1.0"?>
<xsd:schema targetNamespace="http://www.xyz.com/fruit"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:fr="http://www.xyz.com/fruit">
<xsd:complexType name="fruitType">
<xsd:sequence>
<xsd:element name="name" type="xsd:string" minOccurs="1" maxOccurs="1"/>
<xsd:element name="state" type="fr:stateType" minOccurs="1" maxOccurs="1"/>
<xsd:element name="nutritionInfo" type="fr:nutritionInfoType" minOccurs="1"
maxOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="nutritionInfoType">
<xsd:sequence>
<xsd:element name="numCalories" type="xsd:int" minOccurs="1" maxOccurs="1"/>
<xsd:element name="numGramsFat" type="xsd:int" minOccurs="1" maxOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
<xsd:simpleType name="stateType">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="Rotten"/>
<xsd:enumeration value="Fresh"/>
<xsd:enumeration value="WillDo"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:schema>
apple.xsd
=======================================
<?xml version="1.0"?>
<!-- Copyright (c) 2001 Zaplet, Inc. All rights reserved. -->
<xsd:schema targetNamespace="http://www.xyz.com/apple"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:fr="http://www.xyz.com/fruit"
xmlns:app="http://www.xyz.com/apple">
<xsd:import namespace="http://www.xyz.com/fruit"
schemaLocation="C:/castor/test/xmlschema/fruit.xsd" />
<xsd:complexType name="appleType">
<xsd:sequence>
<xsd:element name="appleInfo" type="app:appleInfoType" minOccurs="1"
maxOccurs="1"/>
<xsd:element name="state" type="fr:stateType" minOccurs="1" maxOccurs="1"/>
<xsd:element name="nutritionInfo" type="fr:nutritionInfoType" minOccurs="1"
maxOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="appleInfoType">
<xsd:sequence>
<xsd:element name="appleName" type="xsd:string" minOccurs="1" maxOccurs="1"/>
<xsd:element name="californiaApples" type="xsd:boolean" minOccurs="1"
maxOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev