code: public static boolean isBadXmlCharacter(char c) {
          boolean cDataCharacter = c < '\u0020' && c != '\t' && c != '\r' && c != '\n';
          cDataCharacter |= (c >= '\uD800' && c < '\uE000');
          cDataCharacter |= (c == '\uFFFE' || c == '\uFFFF');
          return cDataCharacter;
      }
docs: Detect bad xml 1.0 characters
  
  @param c to detect
  @return true if specified character valid, false otherwise