diff -urN jud-0.4/jud_search.c jud-0.4.olo/jud_search.c --- jud-0.4/jud_search.c Thu Feb 1 10:46:54 2001 +++ jud-0.4.olo/jud_search.c Mon Dec 9 17:19:54 2002 @@ -39,6 +39,8 @@ int flag_searched = 0; int flag_mismatch = 0; char *data; + char *normalizeddata; + char message[MAX_LOG_SIZE]; for(term = xmlnode_get_firstchild(p->iq); term != NULL; term = xmlnode_get_nextsibling(term)) { @@ -46,7 +48,24 @@ flag_searched = 1; - if(j_strncasecmp(data,xmlnode_get_tag_data(cur,xmlnode_get_name(term)),strlen(data)) != 0) + /* Strip initial whitespace characters to workaround + * a bug in XML parser where empty elements + * on a line with initial whitespaces would + * receive those whitespaces in their content + */ + for (normalizeddata = data; + *normalizeddata != '\0' && + *normalizeddata == '\t' || + *normalizeddata == '\n' || + *normalizeddata == ' ' + ; + normalizeddata++) + ; + data = normalizeddata; + + if( (strlen(data) > 0) && + (j_strncasecmp(data,xmlnode_get_tag_data(cur,xmlnode_get_name(term)),strlen(data)) != 0) + ) flag_mismatch = 1; }