You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by ve...@apache.org on 2015/11/22 22:48:42 UTC

svn commit: r1715706 - in /webservices/axiom/branches/datatypes/datatypes: pom.xml src/main/java/org/apache/axiom/datatype/TypeHelper.java

Author: veithen
Date: Sun Nov 22 21:48:42 2015
New Revision: 1715706

URL: http://svn.apache.org/viewvc?rev=1715706&view=rev
Log:
Use the isWhitespace method from XMLChar.

Modified:
    webservices/axiom/branches/datatypes/datatypes/pom.xml
    webservices/axiom/branches/datatypes/datatypes/src/main/java/org/apache/axiom/datatype/TypeHelper.java

Modified: webservices/axiom/branches/datatypes/datatypes/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/datatypes/datatypes/pom.xml?rev=1715706&r1=1715705&r2=1715706&view=diff
==============================================================================
--- webservices/axiom/branches/datatypes/datatypes/pom.xml (original)
+++ webservices/axiom/branches/datatypes/datatypes/pom.xml Sun Nov 22 21:48:42 2015
@@ -34,6 +34,11 @@
 
     <dependencies>
         <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>xml-utils</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
             <scope>test</scope>

Modified: webservices/axiom/branches/datatypes/datatypes/src/main/java/org/apache/axiom/datatype/TypeHelper.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/datatypes/datatypes/src/main/java/org/apache/axiom/datatype/TypeHelper.java?rev=1715706&r1=1715705&r2=1715706&view=diff
==============================================================================
--- webservices/axiom/branches/datatypes/datatypes/src/main/java/org/apache/axiom/datatype/TypeHelper.java (original)
+++ webservices/axiom/branches/datatypes/datatypes/src/main/java/org/apache/axiom/datatype/TypeHelper.java Sun Nov 22 21:48:42 2015
@@ -18,6 +18,8 @@
  */
 package org.apache.axiom.datatype;
 
+import static org.apache.axiom.util.xml.XMLChar.isWhitespace;
+
 /**
  * Contains utility methods for usage by {@link Type} implementations.
  */
@@ -25,17 +27,6 @@ public final class TypeHelper {
     private TypeHelper() {}
     
     /**
-     * Determine if the given character is whitespace according to the XML specification.
-     * 
-     * @param c
-     *            the character to examine
-     * @return {@code true} if the character is whitespace, {@code false} otherwise
-     */
-    public static boolean isWhitespace(char c) {
-        return c == ' ' || c == '\r' || c == '\n' || c == '\t';
-    }
-    
-    /**
      * Determine the index of the first non whitespace character in the given literal. This method
      * is intended for use in implementations of XSD datatypes for which the {@code whiteSpace}
      * facet is {@code collapse}.
@@ -52,7 +43,7 @@ public final class TypeHelper {
             throw new UnexpectedEndOfStringException(literal);
         }
         int start = 0;
-        while (TypeHelper.isWhitespace(literal.charAt(start))) {
+        while (isWhitespace(literal.charAt(start))) {
             if (++start == len) {
                 throw new UnexpectedEndOfStringException(literal);
             }
@@ -78,7 +69,7 @@ public final class TypeHelper {
             throw new UnexpectedEndOfStringException(literal);
         }
         int end = len;
-        while (TypeHelper.isWhitespace(literal.charAt(end-1))) {
+        while (isWhitespace(literal.charAt(end-1))) {
             if (--end == 0) {
                 throw new UnexpectedEndOfStringException(literal);
             }