Dave,
Thanks for the note.
The current mapping is defined by Chap 20 of JSR 101, so it should not be
changed. I will add a comment to the code.
Rich Scheuerle
XML & Web Services Development
512-838-5115 (IBM TL 678-5115)
Dave Dunkin
<DaveDu@Attachmat To: "Axis-Dev (E-mail)"
<[EMAIL PROTECTED]>
e.com> cc:
Subject: JavaUtils.xmlNameToJava and
special characters
02/06/2002 08:10
PM
Please respond to
axis-dev
The xmlNameToJava function munges strings so that they only contain letters
and numbers. However, other characters (such as '$' and '_') are valid in
Java identifiers. Instead of using the Character.isLetter() and
Character.isLetterOrDigit(), why not use Character.isJavaIdentifierStart()
and Character.isJavaIdentifierPart()? Here's a diff:
*** JavaUtils.java 1 Feb 2002 04:38:18 -0000 1.24
--- JavaUtils.java 7 Feb 2002 01:28:24 -0000
***************
*** 315,325 ****
char[] nameArray = name.toCharArray();
int nameLen = name.length();
StringBuffer result = new StringBuffer(nameLen);
// First character, lower case
int i = 0;
while (i < nameLen
! && !Character.isLetter(nameArray[i])) {
i++;
}
if (i < nameLen) {
--- 315,325 ----
char[] nameArray = name.toCharArray();
int nameLen = name.length();
StringBuffer result = new StringBuffer(nameLen);
// First character, lower case
int i = 0;
while (i < nameLen
! && !Character.isJavaIdentifierStart(nameArray[i])) {
i++;
}
if (i < nameLen) {
***************
*** 336,342 ****
// if this is a bad char, skip it a remember to capitalize
next
// good character we encounter
! if( !Character.isLetterOrDigit(c)) {
wordStart = true;
continue;
}
--- 336,342 ----
// if this is a bad char, skip it a remember to capitalize
next
// good character we encounter
! if( !Character.isJavaIdentifierPart(c)) {
wordStart = true;
continue;
}
Dave Dunkin