Index: HTMLparser.c =================================================================== RCS file: /cvs/gnome/gnome-xml/HTMLparser.c,v retrieving revision 1.88 diff -c -r1.88 HTMLparser.c *** HTMLparser.c 2001/06/24 12:13:20 1.88 --- HTMLparser.c 2001/07/04 15:56:42 *************** *** 3084,3107 **** * With namespace * * [NS 9] ETag ::= '' */ ! static void htmlParseEndTag(htmlParserCtxtPtr ctxt) { xmlChar *name; xmlChar *oldname; ! int i; if ((CUR != '<') || (NXT(1) != '/')) { if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "htmlParseEndTag: 'wellFormed = 0; ! return; } SKIP(2); name = htmlParseHTMLName(ctxt); ! if (name == NULL) return; /* * We should definitely be at the ending "S? '>'" part --- 3084,3109 ---- * With namespace * * [NS 9] ETag ::= '' + * + * Returns 1 if the current level should be closed. */ ! static int htmlParseEndTag(htmlParserCtxtPtr ctxt) { xmlChar *name; xmlChar *oldname; ! int i, ret; if ((CUR != '<') || (NXT(1) != '/')) { if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "htmlParseEndTag: 'wellFormed = 0; ! return(0); } SKIP(2); name = htmlParseHTMLName(ctxt); ! if (name == NULL) return(0); /* * We should definitely be at the ending "S? '>'" part *************** *** 3127,3133 **** "Unexpected end tag : %s\n", name); xmlFree(name); ctxt->wellFormed = 0; ! return; } --- 3129,3135 ---- "Unexpected end tag : %s\n", name); xmlFree(name); ctxt->wellFormed = 0; ! return(0); } *************** *** 3174,3185 **** xmlGenericError(xmlGenericErrorContext,"End of tag %s: stack empty !!!\n", name); #endif } } if (name != NULL) xmlFree(name); ! return; } --- 3176,3190 ---- xmlGenericError(xmlGenericErrorContext,"End of tag %s: stack empty !!!\n", name); #endif } + ret = 1; + } else { + ret = 0; } if (name != NULL) xmlFree(name); ! return(ret); } *************** *** 3285,3301 **** * Our tag or one of it's parent or children is ending. */ if ((CUR == '<') && (NXT(1) == '/')) { ! htmlParseEndTag(ctxt); ! if (currentNode != NULL) xmlFree(currentNode); ! return; } /* * Has this node been popped out during parsing of * the next element */ ! if ((!xmlStrEqual(currentNode, ctxt->name)) && ! (depth >= ctxt->nameNr)) { if (currentNode != NULL) xmlFree(currentNode); return; } --- 3290,3311 ---- * Our tag or one of it's parent or children is ending. */ if ((CUR == '<') && (NXT(1) == '/')) { ! if (htmlParseEndTag(ctxt) && ! ((currentNode != NULL) || (ctxt->nameNr == 0))) { ! if (currentNode != NULL) ! xmlFree(currentNode); ! return; ! } ! continue; /* while */ } /* * Has this node been popped out during parsing of * the next element */ ! if ((ctxt->nameNr > 0) && (depth >= ctxt->nameNr) && ! (!xmlStrEqual(currentNode, ctxt->name))) ! { if (currentNode != NULL) xmlFree(currentNode); return; }