You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by na...@apache.org on 2006/07/03 23:37:34 UTC
svn commit: r418858 -
/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/CUtils.java
Author: nadiramra
Date: Mon Jul 3 14:37:33 2006
New Revision: 418858
URL: http://svn.apache.org/viewvc?rev=418858&view=rev
Log:
Remove duplicate invalid C/C++ symbols and make code more efficient in sanitiseClassName().
Modified:
webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/CUtils.java
Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/CUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/CUtils.java?rev=418858&r1=418857&r2=418858&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/CUtils.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/CUtils.java Mon Jul 3 14:37:33 2006
@@ -26,6 +26,7 @@
import java.util.Hashtable;
import javax.xml.namespace.QName;
import java.util.Vector;
+import java.lang.reflect.Array;
import org.w3c.dom.Node;
import org.apache.axis.wsdl.symbolTable.SymbolTable;
import org.apache.axis.wsdl.toJava.Utils;
@@ -51,8 +52,13 @@
public static final String C_FILE_SUFFIX = ".c";
// File suffix fr C Header files
public static final String C_HEADER_SUFFIX = ".h";
+
// Valid XML but invalid or reserved C/C++ characters
- public static final String VALID_XML_INVALID_C = "//!\"#$%&'()*+,-./:;<=>?@\\^`{|}~[]\u00A3";
+ private static final char invalidCChars[] = {
+ '/', '!', '"', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',',
+ '-', '.', ':', ';', '<', '=', '>', '?', '@', '\\','^', '`', '{',
+ '|', '}', '~', '[', ']', '\u00A3'
+ };
/* This type mapping only maps simple types the mapping for
complex types are done with in the type class */
@@ -72,7 +78,7 @@
private static Hashtable isPointerBasedType = new Hashtable();
private static boolean cpp = true;
- static{
+ static{
class2QNamemapCpp.put("xsd__duration", new QName(WrapperConstants.SCHEMA_NAMESPACE, "duration"));
class2QNamemapCpp.put("xsd__dateTime", new QName(WrapperConstants.SCHEMA_NAMESPACE, "dateTime"));
class2QNamemapCpp.put("xsd__time", new QName(WrapperConstants.SCHEMA_NAMESPACE, "time"));
@@ -1048,18 +1054,8 @@
{
String sanitisedName = name;
- for( int iRSLCount = 0; iRSLCount < VALID_XML_INVALID_C.length(); iRSLCount++)
- {
- int iOffset;
- String sChar = VALID_XML_INVALID_C.substring( iRSLCount, iRSLCount + 1);
-
- while( (iOffset = sanitisedName.indexOf( sChar)) != -1)
- {
- String sBefore = sanitisedName.substring( 0, iOffset);
- String sAfter = sanitisedName.substring( iOffset + 1);
- sanitisedName = sBefore + "_" + sAfter;
- }
- }
+ for( int i=0; i < Array.getLength(invalidCChars); i++)
+ sanitisedName = sanitisedName.replace((char)invalidCChars[i], '_');
//System.out.println("name=" + name + " sanitisedName=" + sanitisedName);
@@ -1075,4 +1071,5 @@
return sanitisedName;
}
-}
+ }
+
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org