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 di...@apache.org on 2006/04/19 15:16:41 UTC
svn commit: r395239 -
/webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/util/XMLUtils.java
Author: dims
Date: Wed Apr 19 06:16:37 2006
New Revision: 395239
URL: http://svn.apache.org/viewcvs?rev=395239&view=rev
Log:
Fix for AXIS2-590 - Please remove broken XMLUtils#xmlEncodeString(String orig)
Modified:
webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/util/XMLUtils.java
Modified: webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/util/XMLUtils.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/util/XMLUtils.java?rev=395239&r1=395238&r2=395239&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/util/XMLUtils.java (original)
+++ webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/util/XMLUtils.java Wed Apr 19 06:16:37 2006
@@ -66,68 +66,6 @@
}
/**
- * Encodes a string appropriately for XML.
- * Lifted from ApacheSOAP 2.2 (org.apache.soap.Utils)
- *
- * @param orig the String to encode
- * @return Returns a String in which XML special chars are repalced by entities.
- */
- public static String xmlEncodeString(String orig)
- {
- if (orig == null)
- {
- return "";
- }
-
- char[] chars = orig.toCharArray();
-
- // if the string doesn't have any of the magic characters, leave
- // it alone.
- boolean needsEncoding = false;
-
- search:
- for(int i = 0; i < chars.length; i++) {
- switch(chars[i]) {
- case '&': case '"': case '\'': case '<': case '>':
- needsEncoding = true;
- break search;
- }
- }
-
- if (!needsEncoding) return orig;
-
- StringBuffer strBuf = new StringBuffer();
- for (int i = 0; i < chars.length; i++)
- {
- switch (chars[i])
- {
- case '&' : strBuf.append("&");
- break;
- case '\"' : strBuf.append(""");
- break;
- case '\'' : strBuf.append("'");
- break;
- case '<' : strBuf.append("<");
- break;
- case '\r' : strBuf.append("
");
- break;
- case '>' : strBuf.append(">");
- break;
- default :
- if (((int)chars[i]) > 127) {
- strBuf.append("&#");
- strBuf.append((int)chars[i]);
- strBuf.append(";");
- } else {
- strBuf.append(chars[i]);
- }
- }
- }
-
- return strBuf.toString();
- }
-
- /**
* Initializes the SAX parser factory.
*
* @param factoryClassName The (optional) class name of the desired