if(strlen(fragmentstr) < tmp) { error("XML: " + this_object()->query_filename() + ": missing close-tag"); }
private mixed process(object fragment){	while(1) {		int tagstart;		string fragmentstr;		fragmentstr = fragment->getString();/*		INFO("bytes left: " + strlen(fragmentstr) );*/		/* When fragment-string is empty, return fragment */		if(strlen(fragmentstr) == 0) {			return fragment;		}		tagstart = index_of(0, fragmentstr, "<");		if(tagstart != 0) {			/* We found some characters, grab them. */			int current;			current = fragment->getFragglesSize();			fragment->setFraggle(current, create_characterdata());			if(tagstart == -1) {				fragment->getFraggleByIndex(current)->setValue( 								entity(fragmentstr) 							);				fragmentstr = "";				fragment->setString(fragmentstr);			}			else {				fragment->getFraggleByIndex(current)->setValue(									entity(fragmentstr[0..tagstart-1])								);				fragment->setString(fragmentstr[tagstart..]);			}		}		else {			/* deal with and get type of upcoming section */			if(fragmentstr[1..1] == "?") {				/* Processing Instructions (PIs) */				fragment = tag_pi(fragment);			}			else {				if(fragmentstr[1..3] == "!--") {					/* comments */					fragment = tag_comment(fragment);				}				else {					if(fragmentstr[1..7] == "!CDATA[") {						/* character data */						INFO("cdata!");						fragment = tag_cdata(fragment);					}					else {						int tmp;						string endstr;						endstr = fragment->getEnd();						tmp = strlen(endstr) + 3 - 1;						if(fragmentstr[1..tmp] == ("/" + endstr + ">") ||						   strip_whitechars(fragmentstr[1..tmp]) == 						   ("/" + endstr)) {							fragment->setString(fragmentstr[tmp+1..]);							fragment->setEnd("");							return fragment;						}						else {							fragment = tag_element(fragment);						}					}				}			}		}	}	/* Nothing to process? */	ERROR("process(): Should not get here [insert good error msg].");	return "";}