if (encoding < FORMAT_UTF_16BE) writeVTD(temp_offset, 5,
writeVTD(temp_offset, 8,
	private int process_dec_attr() throws ParseException, EncodingException, EOFException{		int length1;		int parser_state;		if (ch == 'v' && skipChar('e') && skipChar('r')				&& skipChar('s') && skipChar('i') && skipChar('o')				&& skipChar('n')) {			ch = getCharAfterS();			if (ch == '=') {				/*				 * System.out.println( " " + (temp_offset - 1) + " " +				 * 7 + " dec attr name version " + depth);				 */				if (encoding < FORMAT_UTF_16BE)					writeVTD(temp_offset - 1, 7,							TOKEN_DEC_ATTR_NAME, depth);				else					writeVTD((temp_offset - 2) >> 1, 7,							TOKEN_DEC_ATTR_NAME, depth);			} else				throw new ParseException(						"XML decl error: Invalid char"								+ formatLineNumber());		} else			throw new ParseException(					"XML decl error: should be version"							+ formatLineNumber());		ch_temp = getCharAfterS();		if (ch_temp != '\'' && ch_temp != '"')			throw new ParseException(					"XML decl error: Invalid char to start attr name"							+ formatLineNumber());		temp_offset = offset;		// support 1.0 or 1.1		if (skipChar('1') && skipChar('.')				&& (skipChar('0') || skipChar('1'))) {			/*			 * System.out.println( " " + temp_offset + " " + 3 + "			 * dec attr val (version)" + depth);			 */			if (encoding < FORMAT_UTF_16BE)				writeVTD(temp_offset, 3, TOKEN_DEC_ATTR_VAL, depth);			else				writeVTD(temp_offset >> 1, 3, TOKEN_DEC_ATTR_VAL,						depth);		} else			throw new ParseException(					"XML decl error: Invalid version(other than 1.0 or 1.1) detected"							+ formatLineNumber());		if (!skipChar(ch_temp))			throw new ParseException(					"XML decl error: version not terminated properly"							+ formatLineNumber());		ch = getChar();		//? space or e		if (XMLChar.isSpaceChar(ch)) {			ch = getCharAfterS();			temp_offset = offset - increment;			if (ch == 'e') {				if (skipChar('n') && skipChar('c') && skipChar('o')						&& skipChar('d') && skipChar('i')						&& skipChar('n') && skipChar('g')) {					ch = getChar();					if (XMLChar.isSpaceChar(ch))						ch = getCharAfterS();					if (ch == '=') {						/*						 * System.out.println( " " + (temp_offset) + " " +						 * 8 + " dec attr name (encoding) " +						 * depth);						 */						if (encoding < FORMAT_UTF_16BE)							writeVTD(temp_offset, 8,									TOKEN_DEC_ATTR_NAME, depth);						else							writeVTD(temp_offset >> 1, 8,									TOKEN_DEC_ATTR_NAME, depth);					} else						throw new ParseException(								"XML decl error: Invalid char"										+ formatLineNumber());					ch_temp = getCharAfterS();					if (ch_temp != '"' && ch_temp != '\'')						throw new ParseException(								"XML decl error: Invalid char to start attr name"										+ formatLineNumber());					temp_offset = offset;					ch = getChar();					switch (ch) {					case 'a':					case 'A':						if ((skipChar('s') || skipChar('S'))								&& (skipChar('c') || skipChar('C'))								&& (skipChar('i') || skipChar('I'))								&& (skipChar('i') || skipChar('I'))								&& skipChar(ch_temp)) {							if (encoding != FORMAT_UTF_16LE									&& encoding != FORMAT_UTF_16BE) {								if (must_utf_8)									throw new EncodingException(											"Can't switch from UTF-8"													+ formatLineNumber());								encoding = FORMAT_ASCII;								/*								 * System.out.println( " " +								 * (temp_offset) + " " + 5 + " dec								 * attr val (encoding) " + depth);								 */								if (encoding < FORMAT_UTF_16BE)									writeVTD(temp_offset, 5,											TOKEN_DEC_ATTR_VAL,											depth);								else									writeVTD(temp_offset >> 1, 5,											TOKEN_DEC_ATTR_VAL,											depth);								break;							} else								throw new ParseException(										"XML decl error: Can't switch encoding to ASCII"												+ formatLineNumber());						}						throw new ParseException(								"XML decl error: Invalid Encoding"										+ formatLineNumber());					case 'i':					case 'I':						if ((skipChar('s') || skipChar('S'))								&& (skipChar('o') || skipChar('O'))								&& skipChar('-') && skipChar('8')								&& skipChar('8') && skipChar('5')								&& skipChar('9') && skipChar('-')								&& skipChar('1')								&& skipChar(ch_temp)) {							if (encoding != FORMAT_UTF_16LE									&& encoding != FORMAT_UTF_16BE) {								if (must_utf_8)									throw new EncodingException(											"Can't switch from UTF-8"													+ formatLineNumber());								encoding = FORMAT_ISO_8859;								/*								 * System.out.println( " " +								 * (temp_offset) + " " + 10 + " dec								 * attr val (encoding) " + depth);								 */								if (encoding < FORMAT_UTF_16BE)									writeVTD(temp_offset, 10,											TOKEN_DEC_ATTR_VAL,											depth);								else									writeVTD(temp_offset >> 1, 10,											TOKEN_DEC_ATTR_VAL,											depth);								break;							} else								throw new ParseException(										"XML decl error: Can't switch encoding to ISO-8859"												+ formatLineNumber());						}						throw new ParseException(								"XML decl error: Invalid Encoding"										+ formatLineNumber());					case 'u':					case 'U':						if ((skipChar('s') || skipChar('S')))							if (skipChar('-')									&& (skipChar('a') || skipChar('A'))									&& (skipChar('s') || skipChar('S'))									&& (skipChar('c') || skipChar('C'))									&& (skipChar('i') || skipChar('I'))									&& (skipChar('i') || skipChar('I'))									&& skipChar(ch_temp)) {								if (encoding != FORMAT_UTF_16LE										&& encoding != FORMAT_UTF_16BE) {									if (must_utf_8)										throw new EncodingException(												"Can't switch from UTF-8"														+ formatLineNumber());									encoding = FORMAT_ASCII;									//System.out.println(									//    " " + (temp_offset) + " " + 5									// + " dec attr val (encoding) "									// + depth);									if (encoding < FORMAT_UTF_16BE)										writeVTD(temp_offset, 5,												TOKEN_DEC_ATTR_VAL,												depth);									else										writeVTD(temp_offset >> 1,												5,												TOKEN_DEC_ATTR_VAL,												depth);									break;								} else									throw new ParseException(											"XML decl error: Can't switch encoding to US-ASCII"													+ formatLineNumber());							} else								throw new ParseException(										"XML decl error: Invalid Encoding"												+ formatLineNumber());						if ((skipChar('t') || skipChar('T'))								&& (skipChar('f') || skipChar('F'))								&& skipChar('-')) {							if (skipChar('8') && skipChar(ch_temp)) {								if (encoding != FORMAT_UTF_16LE										&& encoding != FORMAT_UTF_16BE) {									//encoding = FORMAT_UTF8;									/*									 * System.out.println( " " +									 * (temp_offset) + " " + 5 + "									 * dec attr val (encoding) " +									 * depth);									 */									if (encoding < FORMAT_UTF_16BE)										writeVTD(temp_offset, 5,												TOKEN_DEC_ATTR_VAL,												depth);									else										writeVTD(temp_offset >> 1,												5,												TOKEN_DEC_ATTR_VAL,												depth);									break;								} else									throw new ParseException(											"XML decl error: Can't switch encoding to UTF-8"													+ formatLineNumber());							}							if (skipChar('1') && skipChar('6')) {								if (skipChar(ch_temp)) {									if (encoding == FORMAT_UTF_16LE											|| encoding == FORMAT_UTF_16BE) {										if (!BOM_detected)											throw new EncodingException(													"BOM not detected for UTF-16"															+ formatLineNumber());										if (encoding < FORMAT_UTF_16BE)											writeVTD(													temp_offset,													6,													TOKEN_DEC_ATTR_VAL,													depth);										else											writeVTD(													temp_offset >> 1,													6,													TOKEN_DEC_ATTR_VAL,													depth);										break;									}									throw new ParseException(											"XML decl error: Can't switch encoding to UTF-16"													+ formatLineNumber());								} else if ((skipChar('l') || skipChar('L'))										&& (skipChar('e') || skipChar('E'))										&& skipChar(ch_temp)) {									if (encoding == FORMAT_UTF_16LE) {										/*										 * System.out.println( " " +										 * (temp_offset) + " " + 7 + "										 * dec attr val (encoding) " +										 * depth);										 */										if (encoding < FORMAT_UTF_16BE)											writeVTD(													temp_offset,													7,													TOKEN_DEC_ATTR_VAL,													depth);										else											writeVTD(													temp_offset >> 1,													7,													TOKEN_DEC_ATTR_VAL,													depth);										break;									}									throw new ParseException(											"XML del error: Can't switch encoding to UTF-16LE"													+ formatLineNumber());								} else if ((skipChar('b') || skipChar('B'))										&& (skipChar('e') || skipChar('E'))										&& skipChar(ch_temp)) {									if (encoding == FORMAT_UTF_16BE) {										/*										 * System.out.println( " " +										 * (temp_offset) + " " + 7 + "										 * dec attr val (encoding) " +										 * depth);										 */										if (encoding < FORMAT_UTF_16BE)											writeVTD(													temp_offset,													7,													TOKEN_DEC_ATTR_VAL,													depth);										else											writeVTD(													temp_offset >> 1,													7,													TOKEN_DEC_ATTR_VAL,													depth);										break;									}									throw new ParseException(											"XML del error: Can't swtich encoding to UTF-16BE"													+ formatLineNumber());								}								throw new ParseException(										"XML decl error: Invalid encoding"												+ formatLineNumber());							}						}					default:						throw new ParseException(								"XML decl Error: invalid encoding"										+ formatLineNumber());					}					ch = getChar();					if (XMLChar.isSpaceChar(ch))						ch = getCharAfterS();					temp_offset = offset - increment;				} else					throw new ParseException(							"XML decl Error: Invalid char"									+ formatLineNumber());			}			if (ch == 's') {				if (skipChar('t') && skipChar('a') && skipChar('n')						&& skipChar('d') && skipChar('a')						&& skipChar('l') && skipChar('o')						&& skipChar('n') && skipChar('e')) {					ch = getCharAfterS();					if (ch != '=')						throw new ParseException(								"XML decl error: Invalid char"										+ formatLineNumber());					/*					 * System.out.println( " " + temp_offset + " " +					 * 3 + " dec attr name (standalone) " + depth);					 */					if (encoding < FORMAT_UTF_16BE)						writeVTD(temp_offset, 10,								TOKEN_DEC_ATTR_NAME, depth);					else						writeVTD(temp_offset >> 1, 10,								TOKEN_DEC_ATTR_NAME, depth);					ch_temp = getCharAfterS();					temp_offset = offset;					if (ch_temp != '"' && ch_temp != '\'')						throw new ParseException(								"XML decl error: Invalid char to start attr name"										+ formatLineNumber());					ch = getChar();					if (ch == 'y') {						if (skipChar('e') && skipChar('s')								&& skipChar(ch_temp)) {							/*							 * System.out.println( " " +							 * (temp_offset) + " " + 3 + " dec attr							 * val (standalone) " + depth);							 */							if (encoding < FORMAT_UTF_16BE)								writeVTD(temp_offset, 3,										TOKEN_DEC_ATTR_VAL, depth);							else								writeVTD(temp_offset >> 1, 3,										TOKEN_DEC_ATTR_VAL, depth);						} else							throw new ParseException(									"XML decl error: invalid val for standalone"											+ formatLineNumber());					} else if (ch == 'n') {						if (skipChar('o') && skipChar(ch_temp)) {							/*							 * System.out.println( " " +							 * (temp_offset) + " " + 2 + " dec attr							 * val (standalone)" + depth);							 */							if (encoding < FORMAT_UTF_16BE)								writeVTD(temp_offset, 2,										TOKEN_DEC_ATTR_VAL, depth);							else								writeVTD(temp_offset >> 1, 2,										TOKEN_DEC_ATTR_VAL, depth);						} else							throw new ParseException(									"XML decl error: invalid val for standalone"											+ formatLineNumber());					} else						throw new ParseException(								"XML decl error: invalid val for standalone"										+ formatLineNumber());				} else					throw new ParseException("XML decl error"							+ formatLineNumber());				ch = getChar();				if (XMLChar.isSpaceChar(ch))					ch = getCharAfterS();			}		}		if (ch == '?' && skipChar('>')) {			temp_offset = offset;			ch = getCharAfterS();			if (ch == '<') {				parser_state = STATE_LT_SEEN;			} else				throw new ParseException(						"Other Error: Invalid Char in XML"								+ formatLineNumber());		} else			throw new ParseException(					"XML decl Error: Invalid termination sequence"							+ formatLineNumber());		return parser_state;	}