MCPcopy Create free account
hub / github.com/KhronosGroup/OpenCOLLADA / htmlAutoCloseOnClose

Function htmlAutoCloseOnClose

Externals/LibXML/HTMLparser.c:1151–1186  ·  view source on GitHub ↗

* htmlAutoCloseOnClose: * @ctxt: an HTML parser context * @newtag: The new tag name * @force: force the tag closure * * The HTML DTD allows an ending tag to implicitly close other tags. */

Source from the content-addressed store, hash-verified

1149 * The HTML DTD allows an ending tag to implicitly close other tags.
1150 */
1151static void
1152htmlAutoCloseOnClose(htmlParserCtxtPtr ctxt, const xmlChar * newtag)
1153{
1154 const htmlElemDesc *info;
1155 int i, priority;
1156
1157 priority = htmlGetEndPriority(newtag);
1158
1159 for (i = (ctxt->nameNr - 1); i >= 0; i--) {
1160
1161 if (xmlStrEqual(newtag, ctxt->nameTab[i]))
1162 break;
1163 /*
1164 * A missplaced endtag can only close elements with lower
1165 * or equal priority, so if we find an element with higher
1166 * priority before we find an element with
1167 * matching name, we just ignore this endtag
1168 */
1169 if (htmlGetEndPriority(ctxt->nameTab[i]) > priority)
1170 return;
1171 }
1172 if (i < 0)
1173 return;
1174
1175 while (!xmlStrEqual(newtag, ctxt->name)) {
1176 info = htmlTagLookup(ctxt->name);
1177 if ((info != NULL) && (info->endTag == 3)) {
1178 htmlParseErr(ctxt, XML_ERR_TAG_NAME_MISMATCH,
1179 "Opening and ending tag mismatch: %s and %s\n",
1180 newtag, ctxt->name);
1181 }
1182 if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL))
1183 ctxt->sax->endElement(ctxt->userData, ctxt->name);
1184 htmlnamePop(ctxt);
1185 }
1186}
1187
1188/**
1189 * htmlAutoCloseOnEnd:

Callers 1

htmlParseEndTagFunction · 0.85

Calls 6

htmlGetEndPriorityFunction · 0.85
xmlStrEqualFunction · 0.85
htmlTagLookupFunction · 0.85
htmlParseErrFunction · 0.85
htmlnamePopFunction · 0.85
endElementMethod · 0.45

Tested by

no test coverage detected