private boolean isValid(CharSequence text){
  for (int i=0; i < text.length(); i++) {
    char c=text.charAt(i);
    boolean valid=c == 0x9 || c == 0xA || c == 0xD || (c >= 0x20 && c <= 0xd7ff) || (c >= 0xe000 && c <= 0xfffd);
    if (!valid) {
      return false;
    }
  }
  return true;
}

private boolean isValid ( CharSequence text ) { for ( int i = 0 ; i < text . length ( ) ; i ++ ) { char c = text . charAt ( i ) ; boolean valid = c == 0x9 || c == 0xA || c == 0xD || ( c >= 0x20 && c <= 0xd7ff ) || ( c >= 0xe000 && c <= 0xfffd ) ; if ( ! valid ) { return false ; } } return true ; }
returns true if all of the characters in the text are permitted for use in xml documents .
