code: public static boolean isXML11ValidQName(String str) {
  
          final int colon = str.indexOf(':');
  
          if (colon == 0 || colon == str.length() - 1) {
              return false;
          }
         
          if (colon > 0) {
              final String prefix = str.substring(0,colon);
              final String localPart = str.substring(colon+1);
              return isXML11ValidNCName(prefix) && isXML11ValidNCName(localPart);
          }
          else {
              return isXML11ValidNCName(str);
          }
       }
docs: Simple check to determine if qname is legal. If it returns false
  then <param>str</param> is illegal; if it returns true then
  <param>str</param> is legal.