| 4440 | */ |
| 4441 | |
| 4442 | static void |
| 4443 | htmlParseElementInternal(htmlParserCtxtPtr ctxt) { |
| 4444 | const xmlChar *name; |
| 4445 | const htmlElemDesc * info; |
| 4446 | htmlParserNodeInfo node_info = { NULL, 0, 0, 0, 0 }; |
| 4447 | int failed; |
| 4448 | |
| 4449 | if ((ctxt == NULL) || (ctxt->input == NULL)) |
| 4450 | return; |
| 4451 | |
| 4452 | /* Capture start position */ |
| 4453 | if (ctxt->record_info) { |
| 4454 | node_info.begin_pos = ctxt->input->consumed + |
| 4455 | (CUR_PTR - ctxt->input->base); |
| 4456 | node_info.begin_line = ctxt->input->line; |
| 4457 | } |
| 4458 | |
| 4459 | failed = htmlParseStartTag(ctxt); |
| 4460 | name = ctxt->name; |
| 4461 | if ((failed == -1) || (name == NULL)) { |
| 4462 | if (CUR == '>') |
| 4463 | NEXT; |
| 4464 | return; |
| 4465 | } |
| 4466 | |
| 4467 | /* |
| 4468 | * Lookup the info for that element. |
| 4469 | */ |
| 4470 | info = htmlTagLookup(name); |
| 4471 | if (info == NULL) { |
| 4472 | htmlParseErr(ctxt, XML_HTML_UNKNOWN_TAG, |
| 4473 | "Tag %s invalid\n", name, NULL); |
| 4474 | } |
| 4475 | |
| 4476 | /* |
| 4477 | * Check for an Empty Element labeled the XML/SGML way |
| 4478 | */ |
| 4479 | if ((CUR == '/') && (NXT(1) == '>')) { |
| 4480 | SKIP(2); |
| 4481 | if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL)) |
| 4482 | ctxt->sax->endElement(ctxt->userData, name); |
| 4483 | htmlnamePop(ctxt); |
| 4484 | return; |
| 4485 | } |
| 4486 | |
| 4487 | if (CUR == '>') { |
| 4488 | NEXT; |
| 4489 | } else { |
| 4490 | htmlParseErr(ctxt, XML_ERR_GT_REQUIRED, |
| 4491 | "Couldn't find end of Start Tag %s\n", name, NULL); |
| 4492 | |
| 4493 | /* |
| 4494 | * end of parsing of this node. |
| 4495 | */ |
| 4496 | if (xmlStrEqual(name, ctxt->name)) { |
| 4497 | nodePop(ctxt); |
| 4498 | htmlnamePop(ctxt); |
| 4499 | } |
no test coverage detected