startOfWebObjectTag(token.substring(tagIndex, token.length()));
if (token.endsWith("/")) { startOfWebObjectTag(token.substring(tagIndex, token.length() - 1)); endOfWebObjectTag("/"); } else { startOfWebObjectTag(token.substring(tagIndex, token.length())); }
  public void parseHTML() throws WOHTMLFormatException, WODeclarationFormatException, ClassNotFoundException {    Object obj = null;    StringTokenizer templateTokenizer = new StringTokenizer(_unparsedTemplate, "<");    boolean flag = true;    int parserState = STATE_OUTSIDE;    String token;    if (_unparsedTemplate.startsWith("<") || !templateTokenizer.hasMoreTokens()) {      token = null;    }    else {      token = templateTokenizer.nextToken("<");    }    try {      do {        if (!templateTokenizer.hasMoreTokens()) {          break;        }        switch (parserState) {        case STATE_OUTSIDE:          if (token != null) {            if (token.startsWith(">")) {              token = token.substring(1);            }            _contentText.append(token);          }          token = templateTokenizer.nextToken(">");          int tagIndex;          String tagLowerCase = token.toLowerCase();          if (tagLowerCase.startsWith(WOHelperFunctionHTMLParser.WEBOBJECT_START_TAG) || tagLowerCase.startsWith(WOHelperFunctionHTMLParser.WO_START_TAG)) {            if (token.endsWith("/")) {              startOfWebObjectTag(token.substring(0, token.length() - 1));              endOfWebObjectTag("/");            }            else {              startOfWebObjectTag(token);            }          }          else if ((tagIndex = tagLowerCase.indexOf(WOHelperFunctionHTMLParser.WEBOBJECT_START_TAG)) > 1 || (tagIndex = tagLowerCase.indexOf(WOHelperFunctionHTMLParser.WO_START_TAG)) > 1) {            _contentText.append(token.substring(0, token.lastIndexOf("<")));            startOfWebObjectTag(token.substring(tagIndex, token.length()));          }          else if (tagLowerCase.startsWith(WOHelperFunctionHTMLParser.WEBOBJECT_END_TAG) || tagLowerCase.startsWith(WOHelperFunctionHTMLParser.WO_END_TAG)) {            endOfWebObjectTag(token);          }          else if (tagLowerCase.startsWith(WOHelperFunctionHTMLParser.JS_START_TAG)) {            didParseText();            _contentText.append(token);            _contentText.append('>');            flag = false;          }          else if (tagLowerCase.startsWith(WOHelperFunctionHTMLParser.JS_END_TAG)) {            didParseText();            _contentText.append(token);            _contentText.append('>');            flag = true;          }          else if (token.startsWith("<!--") && flag) {            didParseText();            _contentText.append(token);            if (token.endsWith("--")) {              _contentText.append('>');              didParseComment();            }            else {              parserState = STATE_INSIDE_COMMENT;            }          }          else {            _contentText.append(token);            _contentText.append('>');          }          break;        case STATE_INSIDE_COMMENT:          token = templateTokenizer.nextToken(">");          _contentText.append(token);          _contentText.append('>');          if (token.endsWith("--")) {            didParseComment();            parserState = STATE_OUTSIDE;          }          break;        default:          break;        }        token = null;        if (parserState == STATE_OUTSIDE) {          token = templateTokenizer.nextToken("<");        }      } while (true);    }    catch (NoSuchElementException e) {      log.error(e);      didParseText();      return;    }    if (token != null) {      if (token.startsWith(">")) {        token = token.substring(1);      }      _contentText.append(token);    }    didParseText();  }