Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 0.9.6
-
Fix Version/s: 1.0.4
-
Component/s: XML code generator
-
Labels:None
-
Environment:Java 1.4.2_07, Windows XP Pro (SP1).
-
Number of attachments :
Description
I think that there is a bug with setting the java-type in the binding file for an attribute. The problem seems to be that the java-type attribute of the member element has no effect if the attribute to be manipulated did not specify a type in the original schema. If the attribute has a type, then the java-type can be used to modify this mapping.
Below is the binding file. It is attempting to set the java-type for an attribute named 'use'.
<!-- binding file used -->
<?xml version="1.0"?>
<binding xmlns:cbf="http://www.castor.org/SourceGenerator/Binding"
defaultBindingType='element' >
<attributeBinding name="complexType:TestType/@use">
<member name="myUse" java-type="java.lang.String"/>
</attributeBinding>
</binding>
Below is the example schema. If the attribute has no 'type' attribute, then the java-type has no effect. If, as below, a type is specified, then the java-type can be used to modify the type.
<!-- schema -->
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.mac.com/neiltaylor/xsdBinding">
<xsd:element name="test" type="TestType" >
</xsd:element>
<xsd:complexType name="TestType" >
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attribute name="use" type="xsd:integer" />
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
</xsd:schema>
I have tried this on versions back to 0.9.5.3, and get the same result.
Neil
Neil, just used the current codebase from SVN trunk to generate Java classes from the schema given. Within TestType, there's a member named myUse of type java.lang.String, which is obviously what one would expect.