private void parse_tag() throws IOException
	{
		int i_ch = 0;
		String _tag = "";
		
		if(state != STATE.ENDHDR)
		{
			// If last state is not ENDHDR - </DOCHDR>
			// set default state to STARTEL while encountering character <
			state = STATE.STARTEL;
		}
		
		while((i_ch = buffer_rd.read()) != -1)
		{
			char ch = (char)i_ch;

			if(ch == '/')
			{
				state = STATE.ENDEL;
			}
			else if(ch == '>')
			{
				tag = _tag;
				
				if(_tag.compareToIgnoreCase(DOC_TAG_NAME) == 0)
				{
					if(state == STATE.ENDEL)
					{
						state = STATE.ENDDOC;
					}
					else
					{
						state = STATE.STARTDOC;
						doc_state = STATE.INDOC;
						
						docs_count++;
						if(DEBUG == true)
						{
							System.out.println(current_datetime() + " Handle document " + docs_count);							
						}						
					}
				}
				else if(_tag.compareToIgnoreCase(HDR_TAG_NAME) == 0)
				{
					if(state == STATE.ENDEL)
						state = STATE.ENDHDR;
					else
						state = STATE.STARTHDR;
				}				
				break;
			}
			else
			{
				_tag += ch;
			}
		}
	}