Cleanup, patch from Wayne Davison:
- xmlIO.h tree.h: made xmlNodeDump() and xmlNodeDumpOutput() public
- parser.[ch] nanohttp.c HTMLtree.c HTMLparser.c tree.c: applied and
modified slightly Wayne Davison patch adding xmlStrcasecmp and
related function, fixing xmlStrncmp(), and associated cleanup
- result/HTML/entities.html.sax: updating result
Daniel
diff --git a/HTMLparser.c b/HTMLparser.c
index a252766..9799b1b 100644
--- a/HTMLparser.c
+++ b/HTMLparser.c
@@ -598,7 +598,7 @@
/**
* htmlTagLookup:
- * @tag: The tag name
+ * @tag: The tag name in lowercase
*
* Lookup the HTML tag in the ElementTable
*
@@ -2663,19 +2663,11 @@
if ((ctxt == NULL) || (attvalue == NULL))
return;
- encoding = xmlStrstr(attvalue, BAD_CAST"charset=");
- if (encoding == NULL)
- encoding = xmlStrstr(attvalue, BAD_CAST"Charset=");
- if (encoding == NULL)
- encoding = xmlStrstr(attvalue, BAD_CAST"CHARSET=");
+ encoding = xmlStrcasestr(attvalue, BAD_CAST"charset=");
if (encoding != NULL) {
encoding += 8;
} else {
- encoding = xmlStrstr(attvalue, BAD_CAST"charset =");
- if (encoding == NULL)
- encoding = xmlStrstr(attvalue, BAD_CAST"Charset =");
- if (encoding == NULL)
- encoding = xmlStrstr(attvalue, BAD_CAST"CHARSET =");
+ encoding = xmlStrcasestr(attvalue, BAD_CAST"charset =");
if (encoding != NULL)
encoding += 9;
}
@@ -2757,18 +2749,10 @@
att = atts[i++];
while (att != NULL) {
value = atts[i++];
- if ((value != NULL) &&
- ((!xmlStrcmp(att, BAD_CAST"http-equiv")) ||
- (!xmlStrcmp(att, BAD_CAST"Http-Equiv")) ||
- (!xmlStrcmp(att, BAD_CAST"HTTP-EQUIV"))) &&
- ((!xmlStrcmp(value, BAD_CAST"Content-Type")) ||
- (!xmlStrcmp(value, BAD_CAST"content-type")) ||
- (!xmlStrcmp(value, BAD_CAST"CONTENT-TYPE"))))
+ if ((value != NULL) && (!xmlStrcasecmp(att, BAD_CAST"http-equiv"))
+ && (!xmlStrcasecmp(value, BAD_CAST"Content-Type")))
http = 1;
- else if ((value != NULL) &&
- ((!xmlStrcmp(att, BAD_CAST"content")) ||
- (!xmlStrcmp(att, BAD_CAST"Content")) ||
- (!xmlStrcmp(att, BAD_CAST"CONTENT"))))
+ else if ((value != NULL) && (!xmlStrcasecmp(att, BAD_CAST"content")))
content = value;
att = atts[i++];
}