code: private static boolean isValid(String stValue) {
          int scan;
          boolean bValid = true;
  
          for (scan = 0; scan < stValue.length(); scan++) {
              if (scan == 0)
                  bValid = XMLChar.isNCNameStart(stValue.charAt(scan));
              else
                  bValid = XMLChar.isNCName(stValue.charAt(scan));
              if (!bValid)
                  break;
          }
          return bValid;
      }
docs: validate the value against the xsd definition
  <p/>
  NCName ::=  (Letter | '_') (NCNameChar)* NCNameChar ::=  Letter | Digit | '.' | '-' | '_' |
  CombiningChar | Extender