Пример #1
0
    /**
     * Scans a NCName. From Namespaces in XML [5] NCName ::= (Letter | '_') (NCNameChar)* [6]
     * NCNameChar ::= Letter | Digit | '.' | '-' | '_' | CombiningChar | Extender
     *
     * @param data A String containing the XPointer expression
     * @param endOffset The int XPointer expression length
     * @param currentOffset An int representing the current position of the XPointer expression
     *     pointer
     */
    private int scanNCName(String data, int endOffset, int currentOffset) {
      int ch = data.charAt(currentOffset);
      if (ch >= 0x80) {
        if (!XMLChar.isNameStart(ch)) {
          return currentOffset;
        }
      } else {
        byte chartype = fASCIICharMap[ch];
        if (chartype != CHARTYPE_LETTER && chartype != CHARTYPE_UNDERSCORE) {
          return currentOffset;
        }
      }

      // while (currentOffset++ < endOffset) {
      while (++currentOffset < endOffset) {
        ch = data.charAt(currentOffset);
        if (ch >= 0x80) {
          if (!XMLChar.isName(ch)) {
            break;
          }
        } else {
          byte chartype = fASCIICharMap[ch];
          if (chartype != CHARTYPE_LETTER
              && chartype != CHARTYPE_DIGIT
              && chartype != CHARTYPE_PERIOD
              && chartype != CHARTYPE_MINUS
              && chartype != CHARTYPE_UNDERSCORE) {
            break;
          }
        }
      }
      return currentOffset;
    }
Пример #2
0
 // returns true if the given character is
 // a valid nameChar with respect to the version of
 // XML understood by this scanner.
 protected boolean isValidNameChar(int value) {
   return (XMLChar.isName(value));
 } // isValidNameChar(int):  boolean