axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prest...@apache.org
Subject svn commit: r307103 - /webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/CUtils.java
Date Fri, 07 Oct 2005 12:44:15 GMT
Author: prestonf
Date: Fri Oct  7 05:44:12 2005
New Revision: 307103

URL: http://svn.apache.org/viewcvs?rev=307103&view=rev
Log:
Part of the fix for AXISCPP-849 and AXIS-850

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/viewcvs/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/CUtils.java?rev=307103&r1=307102&r2=307103&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 Fri Oct  7
05:44:12 2005
@@ -50,6 +50,8 @@
 	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 = ".;-&*+/^%";
 
 	/* This type mapping only maps simple types the mapping for
 	   complex types are done with in the type class */
@@ -1011,5 +1013,32 @@
 		return null;
 	}	
 	
-	
+    public static String sanitiseClassName( String name)
+    {
+        String sanitisedName = name;
+
+        for( int iRSLCount = 0; iRSLCount < VALID_XML_INVALID_C.length(); iRSLCount++)
+        {
+            sanitisedName.replaceAll( VALID_XML_INVALID_C.substring( iRSLCount, iRSLCount),
"_");
+        }
+        
+        return sanitisedName;
+    }
+
+    public static String sanitiseAttributeName( String classname, String name)
+    {
+        String sanitisedName = name;
+
+        for( int iRSLCount = 0; iRSLCount < VALID_XML_INVALID_C.length(); iRSLCount++)
+        {
+            sanitisedName.replaceAll( VALID_XML_INVALID_C.substring( iRSLCount, iRSLCount),
"_");
+        }
+        
+        if( classname.equals( sanitisedName))
+        {
+            sanitisedName += "_";
+        }
+        
+        return sanitisedName;
+    }
 }



Mime
View raw message