Hello,

The following method of the class org.exolab.javasource.JNaming does not
allow Unicode letters and digits in identifiers. This feature does not
conform to the specification of the Java language.
------------------------------
    /**
     * Returns true if the given String matches the
     * production of a valid Java identifier
     *
     * @param string, the String to check the production of
     * @return true if the given String matches the
     * production of a valid Java name, otherwise false
    **/
    public static boolean isValidJavaIdentifier(String string) {

        if ((string == null) || (string.length() == 0))
            return false;

        for (int i = 0; i < string.length(); i++) {
            char ch = string.charAt(i);

            //-- digit
            if (ch == '_') continue;
            if (ch == '$') continue;

            if ((ch >= 'A') && (ch <= 'Z')) continue;
            if ((ch >= 'a') && (ch <= 'z')) continue;
            if ((ch >= '0') && (ch <= '9')) {
                if (i == 0) return false;
                continue;
            }

            return false;
        }
        if (isKeyword(string)) return false;
        return true;
    } //-- isValidJavaIdentifier

} //-- JNaming
------------------------------
What is the reason for not using e.g. the isJavaLetterOrDigit() method
of the class java.lang.Character here instead?

I have to use schemas that contains elements with names like <mennyis�g>,
<�r> and <sz�veg> resulting class names Mennyis�g, �r and Sz�veg and
finally an exception when running the Source Code Generator.
------------------------------
Exception in thread "main" java.lang.IllegalArgumentException: 'Mennyis�g' is not
a valid Java identifier.
        at org.exolab.javasource.JClass.<init>(JClass.java:150)
        at org.exolab.castor.builder.FactoryState.<init>(SourceFactory.java:2007)
        at 
org.exolab.castor.builder.SourceFactory.createSourceCode(SourceFactory.java:190)
        at 
org.exolab.castor.builder.SourceFactory.processContentModel(SourceFactory.java:1458)
        at 
org.exolab.castor.builder.SourceFactory.processContentModel(SourceFactory.java:1500)
        at 
org.exolab.castor.builder.SourceFactory.processComplexType(SourceFactory.java:1304)
        at 
org.exolab.castor.builder.SourceFactory.createSourceCode(SourceFactory.java:243)
        at 
org.exolab.castor.builder.SourceGenerator.createClasses(SourceGenerator.java:753)
        at 
org.exolab.castor.builder.SourceGenerator.createClasses(SourceGenerator.java:707)
        at 
org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenerator.java:354)
        at 
org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenerator.java:412)
        at 
org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenerator.java:441)
        at org.exolab.castor.builder.SourceGenerator.main(SourceGenerator.java:665)
------------------------------
I would like to know whether this feature will be fixed or not in the next
releases of Castor.

Thanks in advance.

--Peter

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

Reply via email to