Exemple #1
0
  @SuppressWarnings("unchecked")
  @Override
  public TokenText parse() throws CommonException {
    StringBuffer sb = new StringBuffer();
    this.parsedText = "";
    char ch;
    // while((ch = this.page.getNextChar()) != PageSource.EOS)
    while ((ch = this.page.getCurChar()) != PageSource.EOS) {
      if (ch == '<') {
        if (this.parentTokenTag != null) // script value에 의한 주석처리
        {
          String tagName = this.parentTokenTag.getTagName();
          if (tagName.equalsIgnoreCase("script")) {
            int startIndex = this.page.getCurrentCursorPosition() + 2;
            String strPreCon = this.page.getSubString(startIndex, startIndex + "/script".length());

            if (strPreCon.indexOf("script") > -1 || strPreCon.indexOf("SCRIPT") > -1) {
              // this.page.setCursor(-1);
              this.parsedText = sb.toString();
              // return ;
              break;
            } else {
              sb.append(ch);
              this.page.getNextChar();
            }
          }

        } else // 일반 Tag는 무시처리
        {
          // this.page.setCursor(-1);
          this.parsedText = sb.toString();
          // return ;
          break;
        }
      } else {
        // System.out.println("CH:" + ch);
        sb.append(ch);
        this.page.getNextChar();
      }
    }

    TokenTextImpl tti = new TokenTextImpl();
    tti.setValueText(this.parsedText);
    return tti;
  }