code: public static boolean isXML11ValidName(String name) {
          int length = name.length();
          if (length == 0)
              return false;
          int i = 1;
          char ch = name.charAt(0);
          if( !isXML11NameStart(ch) ) {
              if ( length > 1 && isXML11NameHighSurrogate(ch) ) {
                  char ch2 = name.charAt(1);
                  if ( !XMLChar.isLowSurrogate(ch2) || 
                       !isXML11NameStart(XMLChar.supplemental(ch, ch2)) ) {
                      return false;
                  }
                  i = 2;
              }
              else {
                  return false;
              }
          }
          while (i < length) {
              ch = name.charAt(i);
              if ( !isXML11Name(ch) ) {
                  if ( ++i < length && isXML11NameHighSurrogate(ch) ) {
                      char ch2 = name.charAt(i);
                      if ( !XMLChar.isLowSurrogate(ch2) || 
                           !isXML11Name(XMLChar.supplemental(ch, ch2)) ) {
                          return false;
                      }
                  }
                  else {
                      return false;
                  }
              }
              ++i;
          }
          return true;
      }
docs: Check to see if a string is a valid Name according to [5]
  in the XML 1.1 Recommendation
  
  @param name string to check
  @return true if name is a valid Name