length1 = offset - temp_offset - 2 * increment;
length1 = offset - temp_offset - (increment<<1);
	private int process_end_pi() throws ParseException,EncodingException, EOFException{		int length1, parser_state;		ch = r.getChar();		if (XMLChar.isNameStartChar(ch)) {			if ((ch == 'x' || ch == 'X')				&& (r.skipChar('m') || r.skipChar('M'))				&& (r.skipChar('l') && r.skipChar('L'))) {				//temp_offset = offset;				ch = r.getChar();				if (XMLChar.isSpaceChar(ch) || ch == '?')					throw new ParseException(						"Error in PI: [xX][mM][lL] not a valid PI target"							+ formatLineNumber());				//offset = temp_offset;			}			while (true) {				//ch = getChar();				if (!XMLChar.isNameChar(ch)) {					break;				}				ch = r.getChar();			}			length1 = offset - temp_offset - increment;			/*System.out.println(			    ""			        + (char) XMLDoc[temp_offset]			        + " "			        + (temp_offset)			        + " "			        + length1			        + " PI Target "			        + depth);*/			if (encoding < FORMAT_UTF_16BE){				if (length1 > MAX_TOKEN_LENGTH)					  throw new ParseException("Token Length Error:"								  +"PI name too long (>0xfffff)"								  + formatLineNumber());				writeVTD(					temp_offset,					length1,					TOKEN_PI_NAME,					depth);			}			else{				if (length1 > (MAX_TOKEN_LENGTH<<1))				  throw new ParseException("Token Length Error:"						  +"PI name too long (>0xfffff)"						  + formatLineNumber());				writeVTD(					temp_offset >> 1,					length1 >> 1,					TOKEN_PI_NAME,					depth);			}			//length1 = 0;			temp_offset = offset;			if (XMLChar.isSpaceChar(ch)) {				ch = getCharAfterS();				while (true) {					if (XMLChar.isValidChar(ch)) {						if (ch == '?')							if (r.skipChar('>')) {								parser_state = STATE_DOC_END;								break;							} else								throw new ParseException(									"Error in PI: invalid termination sequence"										+ formatLineNumber());					} else						throw new ParseException(							"Error in PI: Invalid char in PI val"								+ formatLineNumber());					ch = r.getChar();				}				length1 = offset - temp_offset - 2 * increment;				if (encoding < FORMAT_UTF_16BE){					if (length1 > MAX_TOKEN_LENGTH)						  throw new ParseException("Token Length Error:"									  +"PI val too long (>0xfffff)"									  + formatLineNumber());					writeVTD(						temp_offset,						length1,						TOKEN_PI_VAL,						depth);				}				else{					if (length1 > (MAX_TOKEN_LENGTH<<1))						  throw new ParseException("Token Length Error:"									  +"PI val too long (>0xfffff)"									  + formatLineNumber());					writeVTD(						temp_offset >> 1,						length1 >> 1,						TOKEN_PI_VAL,						depth);				}				//System.out.println(" " + temp_offset + " " + length1 + " PI val " + depth);			} else {				if ((ch == '?') && r.skipChar('>')) {					parser_state = STATE_DOC_END;				} else					throw new ParseException(						"Error in PI: invalid termination sequence"							+ formatLineNumber());			}			//parser_state = STATE_DOC_END;		} else			throw new ParseException("Error in PI: invalid char in PI target"					+formatLineNumber());		return parser_state;	}