summaryrefslogtreecommitdiff
path: root/HTMLparser.c
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@src.gnome.org>2001-05-03 08:27:20 +0000
committerDaniel Veillard <veillard@src.gnome.org>2001-05-03 08:27:20 +0000
commita2bc368bc9bbca85ad63dca60984ae79ddc4f8c8 (patch)
treef415249e83bf3a4d9a4dd312f3781f492ed96e62 /HTMLparser.c
parent2a0d2e6b14a336b611c99563e192cda0b9af619e (diff)
downloadlibxml2-a2bc368bc9bbca85ad63dca60984ae79ddc4f8c8.tar.gz
- HTMLparser.c: trying to fix the problem reported by Jonas Borgström
- results/HTML/ : a few changes in the output of the HTML tests as a result. - configure.in: tying to fix -liconv where needed Daniel
Diffstat (limited to 'HTMLparser.c')
-rw-r--r--HTMLparser.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/HTMLparser.c b/HTMLparser.c
index ace49d9f..13db1f0c 100644
--- a/HTMLparser.c
+++ b/HTMLparser.c
@@ -564,6 +564,16 @@ static const char *htmlScriptAttributes[] = {
"onselect"
};
+/*
+ * end tags that imply the end of the inside elements
+ */
+const char *htmlEndClose[] = {
+"head",
+"body",
+"html",
+NULL
+};
+
static const char** htmlStartCloseIndex[100];
static int htmlStartCloseIndexinitialized = 0;
@@ -664,7 +674,7 @@ static void
htmlAutoCloseOnClose(htmlParserCtxtPtr ctxt, const xmlChar *newtag) {
htmlElemDescPtr info;
xmlChar *oldname;
- int i;
+ int i, endCloses = 0;
#ifdef DEBUG
xmlGenericError(xmlGenericErrorContext,"Close of %s stack: %d elements\n", newtag, ctxt->nameNr);
@@ -676,6 +686,11 @@ htmlAutoCloseOnClose(htmlParserCtxtPtr ctxt, const xmlChar *newtag) {
if (xmlStrEqual(newtag, ctxt->nameTab[i])) break;
}
if (i < 0) return;
+ for (i = 0; (htmlEndClose[i] != NULL);i++)
+ if (xmlStrEqual(newtag, (const xmlChar *) htmlEndClose[i])) {
+ endCloses = 1;
+ break;
+ }
while (!xmlStrEqual(newtag, ctxt->name)) {
info = htmlTagLookup(ctxt->name);
@@ -692,7 +707,7 @@ htmlAutoCloseOnClose(htmlParserCtxtPtr ctxt, const xmlChar *newtag) {
"Opening and ending tag mismatch: %s and %s\n",
newtag, ctxt->name);
ctxt->wellFormed = 0;
- } else {
+ } else if (endCloses == 0) {
return;
}
if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL))