libs/stream_message/src/minisax.cxx
// ===========================================================================
// Parse content of an element, up to the end of file or an
// end-of-element marker.
//
Parse content of an element, up to the end of file or an
end-of-element marker.
Parse content of an element up to the end of file or an end - of - element marker .
void ActualParser::getContent(string *containing_tag) {
#ifdef ISO_CPP_HEADERS
    ostringstream chars;
#else
    ostrstream chars;
#endif
    for (;;) {
        char ch;
	if (!getChar(ch)) {
	    if (containing_tag != NULL) {
		error("unmatching start tag");
	    }
    	    break;
        }
        if (ch == '<') {
	    SAXParser.noteContent(chars);
	    if (containing_tag != NULL && matchChar('/')) {
		skipWhitespace();
		string tag;
		if (getName(tag)) {
		    if (tag != *containing_tag) {
			error("unmatching end tag");
		    }
		    skipWhitespace();
		    if (!matchChar('>')) {
			error("bad end tag");
			recoverFromGarbledTag();
		    }
		}
		else {
		    error("bad end tag");
		}		
		break;
	    }
	    else if (matchChar('!')) {
			if (matchChar('-')) {
				.
				if (matchChar('-')) {
				int hyphen_count = 0;
				for (;;) {
					char ch;
					if (!getChar(ch)) {
					error("bad comment");
					break;
					}
					else if (hyphen_count >= 2 && ch == '>') {
					break;
					}
					else {
					if (ch == '-') {
						hyphen_count += 1;
					}
					else {
						hyphen_count = 0;
					}
					}
				}
				}
				else {
				error ("bad tag");
				recoverFromGarbledTag();
				}
			}
			else if (matchChar('D')) {
				char ch;
				char tagname [] = { 'O', 'C', 'T', 'Y', 'P', 'E' };
				for(int cntr = 0; cntr < 6; cntr++) {
					if (!getChar(ch)) {
						error("bad tag");
						break;
					}
					else {
					if (tagname[ cntr ] == ch) {
						continue;
					}
					else {
						error("bad tag");
						recoverFromGarbledTag();
						break;
					}
					}
				}
				for(;;) {
					if (!getChar(ch)) {
						error("bad tag");
						break;
					}
					else if('>' == ch) {
						break;
					}
				}
			}
			else {
			error ("bad tag");
			recoverFromGarbledTag();
			}
		}
		else if (matchChar('?')) {
			bool questionmark = false;
			char ch;
			for(;;) {
				if (!getChar(ch)) {
					error("bad tag");
					break;
				}
				else if(questionmark && '>' == ch) {
					break;
				}
				else {
				if ('?' == ch) {
					questionmark = true;
				}
				else {
					questionmark = false;
				}
				}
			}
		}
	    else {
		getElement();
	    }
        }
        else {
	    chars << ch;
        }
    }
    SAXParser.noteContent(chars);
}
void ActualParser :: getContent ( string * containing_tag ) { #ifdef ISO_CPP_HEADERS ostringstream chars ; #else ostrstream chars ; #endif for ( ; ; ) { char ch ; if ( ! getChar ( ch ) ) { if ( containing_tag != NULL ) { error ( " " ) ; } break ; } if ( ch == ' ' ) { SAXParser . noteContent ( chars ) ; if ( containing_tag != NULL && matchChar ( ' ' ) ) { skipWhitespace ( ) ; string tag ; if ( getName ( tag ) ) { if ( tag != * containing_tag ) { error ( " " ) ; } skipWhitespace ( ) ; if ( ! matchChar ( ' ' ) ) { error ( " " ) ; recoverFromGarbledTag ( ) ; } } else { error ( " " ) ; } break ; } else if ( matchChar ( ' ' ) ) { if ( matchChar ( ' ' ) ) { if ( matchChar ( ' ' ) ) { int hyphen_count = 0 ; for ( ; ; ) { char ch ; if ( ! getChar ( ch ) ) { error ( " " ) ; break ; } else if ( hyphen_count >= 2 && ch == ' ' ) { break ; } else { if ( ch == ' ' ) { hyphen_count += 1 ; } else { hyphen_count = 0 ; } } } } else { error ( " " ) ; recoverFromGarbledTag ( ) ; } } else if ( matchChar ( ' ' ) ) { char ch ; char tagname [ ] = { ' ' , ' ' , ' ' , ' ' , ' ' , ' ' } ; for ( int cntr = 0 ; cntr < 6 ; cntr ++ ) { if ( ! getChar ( ch ) ) { error ( " " ) ; break ; } else { if ( tagname [ cntr ] == ch ) { continue ; } else { error ( " " ) ; recoverFromGarbledTag ( ) ; break ; } } } for ( ; ; ) { if ( ! getChar ( ch ) ) { error ( " " ) ; break ; } else if ( ' ' == ch ) { break ; } } } else { error ( " " ) ; recoverFromGarbledTag ( ) ; } } else if ( matchChar ( ' ' ) ) { bool questionmark = false ; char ch ; for ( ; ; ) { if ( ! getChar ( ch ) ) { error ( " " ) ; break ; } else if ( questionmark && ' ' == ch ) { break ; } else { if ( ' ' == ch ) { questionmark = true ; } else { questionmark = false ; } } } } else { getElement ( ) ; } } else { chars << ch ; } } SAXParser . noteContent ( chars ) ; }
Parse content of an element, up to the end of file or an
end-of-element marker.
Parse content of an element up to the end of file or an end - of - element marker .
// could be a comment // could be a comment. // is a comment.  Look for --> // could be a DOCTYPE tag with DTD definition. // is a DOCTYPE tag Look for > // is a xml header & encoding tag.  Look for ?>