public IElementType advance() throws java.io.IOException
  {
    int zzInput;
    int zzAction;

    // cached fields:
    int zzCurrentPosL;
    int zzMarkedPosL;
    int zzEndReadL = zzEndRead;
    CharSequence zzBufferL = zzBuffer;

    int [] zzTransL = ZZ_TRANS;
    int [] zzRowMapL = ZZ_ROWMAP;
    int [] zzAttrL = ZZ_ATTRIBUTE;

    while (true) {
      zzMarkedPosL = zzMarkedPos;

      zzAction = -1;

      zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;

      zzState = ZZ_LEXSTATE[zzLexicalState];

      // set up zzAction for empty match case:
      int zzAttributes = zzAttrL[zzState];
      if ( (zzAttributes & 1) == 1 ) {
        zzAction = zzState;
      }


      zzForAction: {
        while (true) {

          if (zzCurrentPosL < zzEndReadL) {
            zzInput = Character.codePointAt(zzBufferL, zzCurrentPosL);
            zzCurrentPosL += Character.charCount(zzInput);
          }
          else if (zzAtEOF) {
            zzInput = YYEOF;
            break zzForAction;
          }
          else {
            // store back cached positions
            zzCurrentPos  = zzCurrentPosL;
            zzMarkedPos   = zzMarkedPosL;
            boolean eof = zzRefill();
            // get translated positions and possibly new buffer
            zzCurrentPosL  = zzCurrentPos;
            zzMarkedPosL   = zzMarkedPos;
            zzBufferL      = zzBuffer;
            zzEndReadL     = zzEndRead;
            if (eof) {
              zzInput = YYEOF;
              break zzForAction;
            }
            else {
              zzInput = Character.codePointAt(zzBufferL, zzCurrentPosL);
              zzCurrentPosL += Character.charCount(zzInput);
            }
          }
          int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMap(zzInput) ];
          if (zzNext == -1) break zzForAction;
          zzState = zzNext;

          zzAttributes = zzAttrL[zzState];
          if ( (zzAttributes & 1) == 1 ) {
            zzAction = zzState;
            zzMarkedPosL = zzCurrentPosL;
            if ( (zzAttributes & 8) == 8 ) break zzForAction;
          }

        }
      }

      // store back cached position
      zzMarkedPos = zzMarkedPosL;

      if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
        zzAtEOF = true;
        return null;
      }
      else {
        switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
          case 1:
            { return XmlTokenType.XML_DATA_CHARACTERS;
            }
          // fall through
          case 40: break;
          case 2:
            { return XmlTokenType.XML_PI_TARGET;
            }
          // fall through
          case 41: break;
          case 3:
            { return XmlTokenType.XML_REAL_WHITE_SPACE;
            }
          // fall through
          case 42: break;
          case 4:
            { return XmlTokenType.XML_BAD_CHARACTER;
            }
          // fall through
          case 43: break;
          case 5:
            { return XmlTokenType.XML_WHITE_SPACE;
            }
          // fall through
          case 44: break;
          case 6:
            { yybegin(YYINITIAL); return XmlTokenType.XML_DOCTYPE_END;
            }
          // fall through
          case 45: break;
          case 7:
            { return XmlTokenType.XML_COMMENT_CHARACTERS;
            }
          // fall through
          case 46: break;
          case 8:
            { // according to HTML spec (http://www.w3.org/html/wg/drafts/html/master/syntax.html#comments)
  // comments should start with <!-- and end with -->. The comment <!--> is not valid, but should terminate
  // comment token. Please note that it's not true for XML (http://www.w3.org/TR/REC-xml/#sec-comments)
  int loc = getTokenStart();
  char prev = zzBuffer.charAt(loc - 1);
  char prevPrev = zzBuffer.charAt(loc - 2);
  if (prev == '-' && prevPrev == '-') {
    yybegin(YYINITIAL); return XmlTokenType.XML_BAD_CHARACTER;
  }
  return XmlTokenType.XML_COMMENT_CHARACTERS;
            }
          // fall through
          case 47: break;
          case 9:
            { yybegin(C_COMMENT_START); return XmlTokenType.XML_CONDITIONAL_COMMENT_START;
            }
          // fall through
          case 48: break;
          case 10:
            { yybegin(YYINITIAL); yypushback(1); break;
            }
          // fall through
          case 49: break;
          case 11:
            { yybegin(BEFORE_TAG_ATTRIBUTES); return XmlTokenType.XML_NAME;
            }
          // fall through
          case 50: break;
          case 12:
            { return XmlTokenType.XML_START_TAG_START;
            }
          // fall through
          case 51: break;
          case 13:
            { yybegin(TAG_ATTRIBUTES); return XmlTokenType.XML_WHITE_SPACE;
            }
          // fall through
          case 52: break;
          case 14:
            { yybegin(YYINITIAL); return XmlTokenType.XML_TAG_END;
            }
          // fall through
          case 53: break;
          case 15:
            { return XmlTokenType.XML_NAME;
            }
          // fall through
          case 54: break;
          case 16:
            { yybegin(ATTRIBUTE_VALUE_START); return XmlTokenType.XML_EQ;
            }
          // fall through
          case 55: break;
          case 17:
            { yybegin(TAG_ATTRIBUTES); return XmlTokenType.XML_ATTRIBUTE_VALUE_TOKEN;
            }
          // fall through
          case 56: break;
          case 18:
            { yybegin(ATTRIBUTE_VALUE_DQ); return XmlTokenType.XML_ATTRIBUTE_VALUE_START_DELIMITER;
            }
          // fall through
          case 57: break;
          case 19:
            { yybegin(ATTRIBUTE_VALUE_SQ); return XmlTokenType.XML_ATTRIBUTE_VALUE_START_DELIMITER;
            }
          // fall through
          case 58: break;
          case 20:
            { return XmlTokenType.XML_ATTRIBUTE_VALUE_TOKEN;
            }
          // fall through
          case 59: break;
          case 21:
            { yybegin(TAG_ATTRIBUTES); return XmlTokenType.XML_ATTRIBUTE_VALUE_END_DELIMITER;
            }
          // fall through
          case 60: break;
          case 22:
            { yybegin(YYINITIAL); return XmlTokenType.XML_PI_END;
            }
          // fall through
          case 61: break;
          case 23:
            { return XmlTokenType.XML_TAG_CHARACTERS;
            }
          // fall through
          case 62: break;
          case 24:
            { yybegin(COMMENT); return XmlTokenType.XML_COMMENT_CHARACTERS;
            }
          // fall through
          case 63: break;
          case 25:
            { yybegin(COMMENT); return XmlTokenType.XML_CONDITIONAL_COMMENT_END;
            }
          // fall through
          case 64: break;
          case 26:
            { return XmlTokenType.XML_END_TAG_START;
            }
          // fall through
          case 65: break;
          case 27:
            { yybegin(START_TAG_NAME); yypushback(yylength());
            }
          // fall through
          case 66: break;
          case 28:
            { yybegin(PROCESSING_INSTRUCTION); return XmlTokenType.XML_PI_START;
            }
          // fall through
          case 67: break;
          case 29:
            { yybegin(YYINITIAL); return XmlTokenType.XML_EMPTY_ELEMENT_END;
            }
          // fall through
          case 68: break;
          case 30:
            { yybegin(COMMENT); return XmlTokenType.XML_CONDITIONAL_COMMENT_START_END;
            }
          // fall through
          case 69: break;
          case 31:
            { return XmlTokenType.XML_ENTITY_REF_TOKEN;
            }
          // fall through
          case 70: break;
          case 32:
            { yybegin(END_TAG_NAME); yypushback(yylength());
            }
          // fall through
          case 71: break;
          case 33:
            { yybegin(YYINITIAL); return XmlTokenType.XML_COMMENT_END;
            }
          // fall through
          case 72: break;
          case 34:
            { yybegin(C_COMMENT_END); return XmlTokenType.XML_CONDITIONAL_COMMENT_END_START;
            }
          // fall through
          case 73: break;
          case 35:
            { return XmlTokenType.XML_CHAR_ENTITY_REF;
            }
          // fall through
          case 74: break;
          case 36:
            { yybegin(COMMENT); return XmlTokenType.XML_COMMENT_START;
            }
          // fall through
          case 75: break;
          case 37:
            { yybegin(YYINITIAL); return XmlTokenType.XML_BAD_CHARACTER;
            }
          // fall through
          case 76: break;
          case 38:
            { return XmlTokenType.XML_DOCTYPE_PUBLIC;
            }
          // fall through
          case 77: break;
          case 39:
            { yybegin(DOC_TYPE); return XmlTokenType.XML_DOCTYPE_START;
            }
          // fall through
          case 78: break;
          default:
            zzScanError(ZZ_NO_MATCH);
          }
      }
    }
  }
public IElementType advance()