Saturday, 30 July 2011

Whether the given character is a valid XML space.

 

public class Utils {

  /**
   * Tests whether the given character is a valid space.
   */
  public static boolean isXMLSpace(char c) {
    return (c <= 0x0020) &&
           (((((1L << 0x0009) |
               (1L << 0x000A) |
               (1L << 0x000D) |
               (1L << 0x0020)) >> c) & 1L) != 0);
  }

}

   
  

No comments:

Post a Comment