public static String checkXMLName(final String name) {
    // Cannot be empty or null
    if ((name == null)) {
      return "XML names cannot be null";
    }

    final int len = name.length();
    if (len == 0) {
      return "XML names cannot be empty";
    }


    // Cannot start with a number
    if (!isXMLNameStartCharacter(name.charAt(0))) {
      return "XML names cannot begin with the character \"" +
             name.charAt(0) + "\"";
    }
    // Ensure legal content for non-first chars
    for (int i = 1; i < len; i++) {
      if (!isXMLNameCharacter(name.charAt(i))) {
        return "XML names cannot contain the character \"" + name.charAt(i) + "\"";
      }
    }

    // We got here, so everything is OK
    return null;
  }
public static String checkXMLName(final String name)