version 1.72, 2000/10/01 18:23:39
|
version 1.73, 2000/10/01 20:29:37
|
Line 612 htmlTagLookup(const xmlChar *tag) {
|
Line 612 htmlTagLookup(const xmlChar *tag) {
|
|
|
for (i = 0; i < (sizeof(html40ElementTable) / |
for (i = 0; i < (sizeof(html40ElementTable) / |
sizeof(html40ElementTable[0]));i++) { |
sizeof(html40ElementTable[0]));i++) { |
if (!xmlStrcmp(tag, BAD_CAST html40ElementTable[i].name)) |
if (xmlStrEqual(tag, BAD_CAST html40ElementTable[i].name)) |
return(&html40ElementTable[i]); |
return(&html40ElementTable[i]); |
} |
} |
return(NULL); |
return(NULL); |
Line 639 htmlCheckAutoClose(const xmlChar *newtag
|
Line 639 htmlCheckAutoClose(const xmlChar *newtag
|
for (index = 0; index < 100;index++) { |
for (index = 0; index < 100;index++) { |
close = htmlStartCloseIndex[index]; |
close = htmlStartCloseIndex[index]; |
if (close == NULL) return(0); |
if (close == NULL) return(0); |
if (!xmlStrcmp(BAD_CAST *close, newtag)) break; |
if (xmlStrEqual(BAD_CAST *close, newtag)) break; |
} |
} |
|
|
i = close - htmlStartClose; |
i = close - htmlStartClose; |
i++; |
i++; |
while (htmlStartClose[i] != NULL) { |
while (htmlStartClose[i] != NULL) { |
if (!xmlStrcmp(BAD_CAST htmlStartClose[i], oldtag)) { |
if (xmlStrEqual(BAD_CAST htmlStartClose[i], oldtag)) { |
return(1); |
return(1); |
} |
} |
i++; |
i++; |
Line 673 htmlAutoCloseOnClose(htmlParserCtxtPtr c
|
Line 673 htmlAutoCloseOnClose(htmlParserCtxtPtr c
|
#endif |
#endif |
|
|
for (i = (ctxt->nameNr - 1);i >= 0;i--) { |
for (i = (ctxt->nameNr - 1);i >= 0;i--) { |
if (!xmlStrcmp(newtag, ctxt->nameTab[i])) break; |
if (xmlStrEqual(newtag, ctxt->nameTab[i])) break; |
} |
} |
if (i < 0) return; |
if (i < 0) return; |
|
|
while (xmlStrcmp(newtag, ctxt->name)) { |
while (!xmlStrEqual(newtag, ctxt->name)) { |
info = htmlTagLookup(ctxt->name); |
info = htmlTagLookup(ctxt->name); |
if ((info == NULL) || (info->endTag == 1)) { |
if ((info == NULL) || (info->endTag == 1)) { |
#ifdef DEBUG |
#ifdef DEBUG |
Line 738 htmlAutoClose(htmlParserCtxtPtr ctxt, co
|
Line 738 htmlAutoClose(htmlParserCtxtPtr ctxt, co
|
htmlAutoCloseOnClose(ctxt, BAD_CAST"html"); |
htmlAutoCloseOnClose(ctxt, BAD_CAST"html"); |
} |
} |
while ((newtag == NULL) && (ctxt->name != NULL) && |
while ((newtag == NULL) && (ctxt->name != NULL) && |
((!xmlStrcmp(ctxt->name, BAD_CAST"head")) || |
((xmlStrEqual(ctxt->name, BAD_CAST"head")) || |
(!xmlStrcmp(ctxt->name, BAD_CAST"body")) || |
(xmlStrEqual(ctxt->name, BAD_CAST"body")) || |
(!xmlStrcmp(ctxt->name, BAD_CAST"html")))) { |
(xmlStrEqual(ctxt->name, BAD_CAST"html")))) { |
#ifdef DEBUG |
#ifdef DEBUG |
fprintf(stderr,"htmlAutoClose: EOF closes %s\n", ctxt->name); |
fprintf(stderr,"htmlAutoClose: EOF closes %s\n", ctxt->name); |
#endif |
#endif |
Line 775 htmlAutoCloseTag(htmlDocPtr doc, const x
|
Line 775 htmlAutoCloseTag(htmlDocPtr doc, const x
|
htmlNodePtr child; |
htmlNodePtr child; |
|
|
if (elem == NULL) return(1); |
if (elem == NULL) return(1); |
if (!xmlStrcmp(name, elem->name)) return(0); |
if (xmlStrEqual(name, elem->name)) return(0); |
if (htmlCheckAutoClose(elem->name, name)) return(1); |
if (htmlCheckAutoClose(elem->name, name)) return(1); |
child = elem->children; |
child = elem->children; |
while (child != NULL) { |
while (child != NULL) { |
Line 820 htmlIsAutoClosed(htmlDocPtr doc, htmlNod
|
Line 820 htmlIsAutoClosed(htmlDocPtr doc, htmlNod
|
*/ |
*/ |
void |
void |
htmlCheckImplied(htmlParserCtxtPtr ctxt, const xmlChar *newtag) { |
htmlCheckImplied(htmlParserCtxtPtr ctxt, const xmlChar *newtag) { |
if (!xmlStrcmp(newtag, BAD_CAST"html")) |
if (xmlStrEqual(newtag, BAD_CAST"html")) |
return; |
return; |
if (ctxt->nameNr <= 0) { |
if (ctxt->nameNr <= 0) { |
#ifdef DEBUG |
#ifdef DEBUG |
Line 830 htmlCheckImplied(htmlParserCtxtPtr ctxt,
|
Line 830 htmlCheckImplied(htmlParserCtxtPtr ctxt,
|
if ((ctxt->sax != NULL) && (ctxt->sax->startElement != NULL)) |
if ((ctxt->sax != NULL) && (ctxt->sax->startElement != NULL)) |
ctxt->sax->startElement(ctxt->userData, BAD_CAST"html", NULL); |
ctxt->sax->startElement(ctxt->userData, BAD_CAST"html", NULL); |
} |
} |
if ((!xmlStrcmp(newtag, BAD_CAST"body")) || (!xmlStrcmp(newtag, BAD_CAST"head"))) |
if ((xmlStrEqual(newtag, BAD_CAST"body")) || (xmlStrEqual(newtag, BAD_CAST"head"))) |
return; |
return; |
if (ctxt->nameNr <= 1) { |
if (ctxt->nameNr <= 1) { |
if ((!xmlStrcmp(newtag, BAD_CAST"script")) || |
if ((xmlStrEqual(newtag, BAD_CAST"script")) || |
(!xmlStrcmp(newtag, BAD_CAST"style")) || |
(xmlStrEqual(newtag, BAD_CAST"style")) || |
(!xmlStrcmp(newtag, BAD_CAST"meta")) || |
(xmlStrEqual(newtag, BAD_CAST"meta")) || |
(!xmlStrcmp(newtag, BAD_CAST"link")) || |
(xmlStrEqual(newtag, BAD_CAST"link")) || |
(!xmlStrcmp(newtag, BAD_CAST"title")) || |
(xmlStrEqual(newtag, BAD_CAST"title")) || |
(!xmlStrcmp(newtag, BAD_CAST"base"))) { |
(xmlStrEqual(newtag, BAD_CAST"base"))) { |
/* |
/* |
* dropped OBJECT ... i you put it first BODY will be |
* dropped OBJECT ... i you put it first BODY will be |
* assumed ! |
* assumed ! |
Line 888 htmlCheckParagraph(htmlParserCtxtPtr ctx
|
Line 888 htmlCheckParagraph(htmlParserCtxtPtr ctx
|
return(1); |
return(1); |
} |
} |
for (i = 0; htmlNoContentElements[i] != NULL; i++) { |
for (i = 0; htmlNoContentElements[i] != NULL; i++) { |
if (!xmlStrcmp(tag, BAD_CAST htmlNoContentElements[i])) { |
if (xmlStrEqual(tag, BAD_CAST htmlNoContentElements[i])) { |
#ifdef DEBUG |
#ifdef DEBUG |
fprintf(stderr,"Implied element paragraph\n"); |
fprintf(stderr,"Implied element paragraph\n"); |
#endif |
#endif |
Line 1227 htmlEntityLookup(const xmlChar *name) {
|
Line 1227 htmlEntityLookup(const xmlChar *name) {
|
|
|
for (i = 0;i < (sizeof(html40EntitiesTable)/ |
for (i = 0;i < (sizeof(html40EntitiesTable)/ |
sizeof(html40EntitiesTable[0]));i++) { |
sizeof(html40EntitiesTable[0]));i++) { |
if (!xmlStrcmp(name, BAD_CAST html40EntitiesTable[i].name)) { |
if (xmlStrEqual(name, BAD_CAST html40EntitiesTable[i].name)) { |
#ifdef DEBUG |
#ifdef DEBUG |
fprintf(stderr,"Found entity %s\n", name); |
fprintf(stderr,"Found entity %s\n", name); |
#endif |
#endif |
Line 1650 static int areBlanks(htmlParserCtxtPtr c
|
Line 1650 static int areBlanks(htmlParserCtxtPtr c
|
if (CUR != '<') return(0); |
if (CUR != '<') return(0); |
if (ctxt->name == NULL) |
if (ctxt->name == NULL) |
return(1); |
return(1); |
if (!xmlStrcmp(ctxt->name, BAD_CAST"html")) |
if (xmlStrEqual(ctxt->name, BAD_CAST"html")) |
return(1); |
return(1); |
if (!xmlStrcmp(ctxt->name, BAD_CAST"head")) |
if (xmlStrEqual(ctxt->name, BAD_CAST"head")) |
return(1); |
return(1); |
if (!xmlStrcmp(ctxt->name, BAD_CAST"body")) |
if (xmlStrEqual(ctxt->name, BAD_CAST"body")) |
return(1); |
return(1); |
if (ctxt->node == NULL) return(0); |
if (ctxt->node == NULL) return(0); |
lastChild = xmlGetLastChild(ctxt->node); |
lastChild = xmlGetLastChild(ctxt->node); |
Line 2805 htmlParseStartTag(htmlParserCtxtPtr ctxt
|
Line 2805 htmlParseStartTag(htmlParserCtxtPtr ctxt
|
ctxt->wellFormed = 0; |
ctxt->wellFormed = 0; |
return; |
return; |
} |
} |
if (!xmlStrcmp(name, BAD_CAST"meta")) |
if (xmlStrEqual(name, BAD_CAST"meta")) |
meta = 1; |
meta = 1; |
|
|
/* |
/* |
Line 2837 htmlParseStartTag(htmlParserCtxtPtr ctxt
|
Line 2837 htmlParseStartTag(htmlParserCtxtPtr ctxt
|
* Well formedness requires at most one declaration of an attribute |
* Well formedness requires at most one declaration of an attribute |
*/ |
*/ |
for (i = 0; i < nbatts;i += 2) { |
for (i = 0; i < nbatts;i += 2) { |
if (!xmlStrcmp(atts[i], attname)) { |
if (xmlStrEqual(atts[i], attname)) { |
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) |
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) |
ctxt->sax->error(ctxt->userData, |
ctxt->sax->error(ctxt->userData, |
"Attribute %s redefined\n", |
"Attribute %s redefined\n", |
Line 2962 htmlParseEndTag(htmlParserCtxtPtr ctxt)
|
Line 2962 htmlParseEndTag(htmlParserCtxtPtr ctxt)
|
* then return, it's just an error. |
* then return, it's just an error. |
*/ |
*/ |
for (i = (ctxt->nameNr - 1);i >= 0;i--) { |
for (i = (ctxt->nameNr - 1);i >= 0;i--) { |
if (!xmlStrcmp(name, ctxt->nameTab[i])) break; |
if (xmlStrEqual(name, ctxt->nameTab[i])) break; |
} |
} |
if (i < 0) { |
if (i < 0) { |
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) |
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) |
Line 2985 htmlParseEndTag(htmlParserCtxtPtr ctxt)
|
Line 2985 htmlParseEndTag(htmlParserCtxtPtr ctxt)
|
* With the exception that the autoclose may have popped stuff out |
* With the exception that the autoclose may have popped stuff out |
* of the stack. |
* of the stack. |
*/ |
*/ |
if (xmlStrcmp(name, ctxt->name)) { |
if (!xmlStrEqual(name, ctxt->name)) { |
#ifdef DEBUG |
#ifdef DEBUG |
fprintf(stderr,"End of tag %s: expecting %s\n", name, ctxt->name); |
fprintf(stderr,"End of tag %s: expecting %s\n", name, ctxt->name); |
#endif |
#endif |
if ((ctxt->name != NULL) && |
if ((ctxt->name != NULL) && |
(xmlStrcmp(ctxt->name, name))) { |
(!xmlStrEqual(ctxt->name, name))) { |
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) |
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) |
ctxt->sax->error(ctxt->userData, |
ctxt->sax->error(ctxt->userData, |
"Opening and ending tag mismatch: %s and %s\n", |
"Opening and ending tag mismatch: %s and %s\n", |
Line 3003 htmlParseEndTag(htmlParserCtxtPtr ctxt)
|
Line 3003 htmlParseEndTag(htmlParserCtxtPtr ctxt)
|
* SAX: End of Tag |
* SAX: End of Tag |
*/ |
*/ |
oldname = ctxt->name; |
oldname = ctxt->name; |
if ((oldname != NULL) && (!xmlStrcmp(oldname, name))) { |
if ((oldname != NULL) && (xmlStrEqual(oldname, name))) { |
if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL)) |
if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL)) |
ctxt->sax->endElement(ctxt->userData, name); |
ctxt->sax->endElement(ctxt->userData, name); |
oldname = htmlnamePop(ctxt); |
oldname = htmlnamePop(ctxt); |
Line 3134 htmlParseContent(htmlParserCtxtPtr ctxt)
|
Line 3134 htmlParseContent(htmlParserCtxtPtr ctxt)
|
* Has this node been popped out during parsing of |
* Has this node been popped out during parsing of |
* the next element |
* the next element |
*/ |
*/ |
if ((xmlStrcmp(currentNode, ctxt->name)) && |
if ((!xmlStrEqual(currentNode, ctxt->name)) && |
(depth >= ctxt->nameNr)) { |
(depth >= ctxt->nameNr)) { |
if (currentNode != NULL) xmlFree(currentNode); |
if (currentNode != NULL) xmlFree(currentNode); |
return; |
return; |
Line 3245 htmlParseElement(htmlParserCtxtPtr ctxt)
|
Line 3245 htmlParseElement(htmlParserCtxtPtr ctxt)
|
else |
else |
fprintf(stderr, "Start of element %s, was %s\n", name, oldname); |
fprintf(stderr, "Start of element %s, was %s\n", name, oldname); |
#endif |
#endif |
if (((depth == ctxt->nameNr) && (!xmlStrcmp(oldname, ctxt->name))) || |
if (((depth == ctxt->nameNr) && (xmlStrEqual(oldname, ctxt->name))) || |
(name == NULL)) { |
(name == NULL)) { |
if (CUR == '>') |
if (CUR == '>') |
NEXT; |
NEXT; |
Line 3301 htmlParseElement(htmlParserCtxtPtr ctxt)
|
Line 3301 htmlParseElement(htmlParserCtxtPtr ctxt)
|
/* |
/* |
* end of parsing of this node. |
* end of parsing of this node. |
*/ |
*/ |
if (!xmlStrcmp(name, ctxt->name)) { |
if (xmlStrEqual(name, ctxt->name)) { |
nodePop(ctxt); |
nodePop(ctxt); |
oldname = htmlnamePop(ctxt); |
oldname = htmlnamePop(ctxt); |
#ifdef DEBUG |
#ifdef DEBUG |
Line 3993 htmlParseTryOrFinish(htmlParserCtxtPtr c
|
Line 3993 htmlParseTryOrFinish(htmlParserCtxtPtr c
|
name, oldname); |
name, oldname); |
#endif |
#endif |
if (((depth == ctxt->nameNr) && |
if (((depth == ctxt->nameNr) && |
(!xmlStrcmp(oldname, ctxt->name))) || |
(xmlStrEqual(oldname, ctxt->name))) || |
(name == NULL)) { |
(name == NULL)) { |
if (CUR == '>') |
if (CUR == '>') |
NEXT; |
NEXT; |
Line 4055 htmlParseTryOrFinish(htmlParserCtxtPtr c
|
Line 4055 htmlParseTryOrFinish(htmlParserCtxtPtr c
|
/* |
/* |
* end of parsing of this node. |
* end of parsing of this node. |
*/ |
*/ |
if (!xmlStrcmp(name, ctxt->name)) { |
if (xmlStrEqual(name, ctxt->name)) { |
nodePop(ctxt); |
nodePop(ctxt); |
oldname = htmlnamePop(ctxt); |
oldname = htmlnamePop(ctxt); |
#ifdef DEBUG |
#ifdef DEBUG |