You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by ba...@apache.org on 2002/02/25 19:47:25 UTC

cvs commit: jakarta-commons-sandbox/util/src/java/org/apache/commons/util XmlUtils.java

bayard      02/02/25 10:47:25

  Modified:    util/src/java/org/apache/commons/util XmlUtils.java
  Log:
  Changed to use lang.Strings.
  
  The name of this file will be changing to XmlString or XmlStrings at some
  point. However I am delaying this name change as I will probably create a
  xml/ subpackage for it at the same time.
  
  Revision  Changes    Path
  1.3       +8 -6      jakarta-commons-sandbox/util/src/java/org/apache/commons/util/XmlUtils.java
  
  Index: XmlUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/util/src/java/org/apache/commons/util/XmlUtils.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XmlUtils.java	26 Aug 2001 05:55:00 -0000	1.2
  +++ XmlUtils.java	25 Feb 2002 18:47:25 -0000	1.3
  @@ -54,18 +54,20 @@
    * <http://www.apache.org/>.
    */
   
  +import org.apache.commons.lang.Strings;
  +
   /**
    * XML helping static methods.
    *
    * @author bayard@generationjava.com
  - * @version $Id: XmlUtils.java,v 1.2 2001/08/26 05:55:00 dlr Exp $
  + * @version $Id: XmlUtils.java,v 1.3 2002/02/25 18:47:25 bayard Exp $
    */
   final public class XmlUtils {
   
       static public String escapeXml(String str) {
  -        str = StringUtils.replace(str,"&","&amp;");
  -        str = StringUtils.replace(str,"<","&lt;");
  -        str = StringUtils.replace(str,">","&gt;");
  +        str = Strings.replace(str,"&","&amp;");
  +        str = Strings.replace(str,"<","&lt;");
  +        str = Strings.replace(str,">","&gt;");
           return str;
       }
   
  @@ -108,7 +110,7 @@
           if(nextCloseIdx == -1) {
               return -1;
           }
  -        int count = StringUtils.countMatches(text.substring(start, nextCloseIdx), open);
  +        int count = Strings.countMatches(text.substring(start, nextCloseIdx), open);
           if(count == 0) {
               return -1;  // tag is never opened
           }
  @@ -118,7 +120,7 @@
               if(nextCloseIdx == -1) {
                   return -1;
               }
  -            count = StringUtils.countMatches(text.substring(start, nextCloseIdx), open);
  +            count = Strings.countMatches(text.substring(start, nextCloseIdx), open);
               expected++;
           }
           return nextCloseIdx;
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>