Has anybody faced this problem before?
If an element in the schema file has type 'hexBinary' then as per Castor documentation it maps to the premitive byte array. This is fine. But when it has any fixed / default value associated in the schema definition then the generated class has the incorrect syntax.

Conside the following schema -

<?xml version="1.0"?>
<xsd:schema xmlns:xsd           = "http://www.w3.org/2001/XMLSchema"
            
          xmlns               = "http://www.foo.com/mySchema"
                targetNamespace   !   = "
http://www.foo.com/mySchema"
                elementFormDefault  = "qualified">
  <xsd:element name="root">
    <xsd:complexType>
            <xsd:attribute name="id" type="xsd:hexBinary" fixed="100"/>
    </xsd:complexType>  
  </xsd:element>  
</xsd:schema>    

then, the class generated for the element - 'root', has the following lines of code

public class Root implements java.io.Serializable {
      private byte[] _id = new byte[]("100");
      //----------------/
     //- Constructors -/
    //----------------/

    public Root() {
        super();
        setId(new byte[]("100"));
    } //-- Root()

     .....
     // Rest of the class implementation
    .....
}

While compiling, this gives error - obviously :), as the construction of byte array is incorrect.

I tried with org.exolab.castor.builder.primitivetowrapper=false and  changing it to true also, but with no effect. I am using Castor version 0.9.4 and tried with the latest 0.9.4.1

Am I missing any thing here?
I tried searching this issue on the mailing list but could not find any posting. I found another part of my observation, i.e Marshaller writes byte array (handle) instead of its content.

Any help regarding this is appriciated.
Thanks in advance,
Vinay.



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

Reply via email to