code: public static boolean isValidName( String name ) {
          if (name == null || name.length() == 0) return false;
          CharacterIterator iter = new StringCharacterIterator(name);
          char c = iter.first();
          if (!isValidNameStart(c)) return false;
          while (c != CharacterIterator.DONE) {
              if (!isValidName(c)) return false;
              c = iter.next();
          }
          return true;
      }
docs: Determine if the supplied name is a valid XML Name.
  
  @param name the string being checked
  @return true if the supplied name is indeed a valid XML Name, or false otherwise