Hi Werner & all..

Quoting "Werner Guttmann" <[EMAIL PROTECTED]>:
Hi Martin,

Martin S. Weber wrote:
Hey people,

so I've found that castor (wrongly) creates Java Enums of all uppercase
symbols for an xsd:enumeration xsd:restriction like the following:

<xsd:simpleType>
 <xsd:restriction base="xsd:token">
  <xsd:enumeration value="m"> <!-- prefix 'milli' -->
  <xsd:enumeration value="M"> <!-- prefix 'mega' -->
 </xsd:restriction>
</xsd:simpleType>

The generated enum symbols for that will be 'M' and, er, yes, 'M'. So I
found that code, fixed it, and then wanted to compile castor.
Is there really a need to fix this ? Actually, with java 5.0 you might
have a valid point there. But I am not 100% convinced ....

Ok, let's try.

shot 1: mega and milli are two different entities, their abbreviations are well defined and well known, and you can't just change the case of the lowercase 'm' to the uppercase 'M' as that gives you a 10^9 error!

shot 2: this is for software to use unitsml, a language (in its nappies still) that is to be used to transport unit information. m going to M is a killer argument to not use castor.

shot 3: XML is case sensitive. Yes this sucks. It should be case-ignorant and -preserving, but it isn't. It's case sensitive. You can't just change the case of things. I mean.. you just can't.

shot 4: You generate code that doesn't compile when ignoring the case. (Look at the source code generators output for the example I cited -- you're getting a clash for dual 'M's.)

I understand that the java naming conventions are different, and that you like to generate code that follows the java culture. But the XML culture is different. E.g. Look at those two elements: <starts-with> and <starts-With>. Yes it's braindead, but they are two different elements. Generating method names incorporating the fragment startsWith for *both* is just wrong with regard to the XML culture (shot 5?). As you see this applies to applying java naming conventions _in general_ to xml stuff.

Yes the output is alien and ugly and ... Go complain to the W3C. It's them who are braindead. If you want to make conformant XML processors, you have to be braindead, too. There's just no choice.

Regards,

-Martin

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to