code: @SuppressWarnings("cast")
      @Override
      public String validate(DTDValidatorBase v, char[] cbuf, int start, int end, boolean normalize)
          throws XMLStreamException
      {
          // Let's trim leading white space first...
          while (start < end && WstxInputData.isSpaceChar(cbuf[start])) {
              ++start;
          }
  
          // No id?
          if (start >= end) {
              return reportValidationProblem(v, "Empty ID value");
          }
          --end; // so that it now points to the last char
          while (end > start && WstxInputData.isSpaceChar(cbuf[end])) {
              --end;
          }
  
          // Ok, need to check char validity, and also calc hash code:
          char c = cbuf[start];
          if (!WstxInputData.isNameStartChar(c, mCfgNsAware, mCfgXml11)) {
              return reportInvalidChar(v, c, "not valid as the first ID character");
          }
          int hash = (int) c;
          for (int i = start+1; i <= end; ++i) {
              c = cbuf[i];
              if (!WstxInputData.isNameChar(c, mCfgNsAware, mCfgXml11)) {
                  return reportInvalidChar(v, c, "not valid as an ID character");
              }
              hash = (hash * 31) + (int) c;
          }
  
          // Either way, we do need to validate characters, and calculate hash
          ElementIdMap m = v.getIdMap();
          PrefixedName elemName = v.getElemName();
          Location loc = v.getLocation();
          ElementId id = m.addDefined(cbuf, start, (end - start + 1), hash,
                                      loc, elemName, mName);
  
          // We can detect dups by checking if Location is the one we passed:
          if (id.getLocation() != loc) {
              return reportValidationProblem(v, "Duplicate id '"+id.getId()+"', first declared at "
                                             +id.getLocation());
          }
  
          if (normalize) {
              return id.getId();
          }
          return null;
      }
docs: Method called by the validator
  to let the attribute do necessary normalization and/or validation
  for the value.