code: public static String getValidName(String name) {
          StringBuilder validname = new StringBuilder();
          char ch = name.charAt(0);
          if (!XML11Char.isXML11NameStart(ch)) {
              LOG.warn("Prepend _ to " + name);
              validname.append("_");
          }
          for (int i = 0; i < name.length(); i++) {
              ch = name.charAt(i);
              if (!XML11Char.isXML11Name(ch)) {
                  LOG.warn("Character " + ch + " in " + name
                      + " is converted to _");
                  validname.append("_");
              } else {
                  validname.append(ch);
              }
          }
  
          return validname.toString();
      }
docs: Get valid element name from a given string
  @param name
  @return