protected void parseEndTag() {
    // 1. read name (skipping the </ part)
    int i;

    for (i = position + 2; i < text.length(); i++) {
      char c = text.charAt(i);
      if (Character.isSpaceChar(c) || c == '>') {
        break;
      }
    }

    String tagName = text.substring(position + 2, i).toLowerCase();

    if (ignoreUntil != null && ignoreUntil.equals(tagName)) {
      ignoreUntil = null;
    }
    if (ignoreUntil == null) {
      closeTag(tagName);        // advance to end '>'
    }
    while (i < text.length() && text.charAt(i) != '>') {
      i++;
    }
    position = i;
  }