| 4296 | */ |
| 4297 | |
| 4298 | void |
| 4299 | htmlParseElement(htmlParserCtxtPtr ctxt) { |
| 4300 | const xmlChar *name; |
| 4301 | xmlChar *currentNode = NULL; |
| 4302 | const htmlElemDesc * info; |
| 4303 | htmlParserNodeInfo node_info; |
| 4304 | int failed; |
| 4305 | int depth; |
| 4306 | const xmlChar *oldptr; |
| 4307 | |
| 4308 | if ((ctxt == NULL) || (ctxt->input == NULL)) |
| 4309 | return; |
| 4310 | |
| 4311 | /* Capture start position */ |
| 4312 | if (ctxt->record_info) { |
| 4313 | node_info.begin_pos = ctxt->input->consumed + |
| 4314 | (CUR_PTR - ctxt->input->base); |
| 4315 | node_info.begin_line = ctxt->input->line; |
| 4316 | } |
| 4317 | |
| 4318 | failed = htmlParseStartTag(ctxt); |
| 4319 | name = ctxt->name; |
| 4320 | if ((failed == -1) || (name == NULL)) { |
| 4321 | if (CUR == '>') |
| 4322 | NEXT; |
| 4323 | return; |
| 4324 | } |
| 4325 | |
| 4326 | /* |
| 4327 | * Lookup the info for that element. |
| 4328 | */ |
| 4329 | info = htmlTagLookup(name); |
| 4330 | if (info == NULL) { |
| 4331 | htmlParseErr(ctxt, XML_HTML_UNKNOWN_TAG, |
| 4332 | "Tag %s invalid\n", name, NULL); |
| 4333 | } |
| 4334 | |
| 4335 | /* |
| 4336 | * Check for an Empty Element labeled the XML/SGML way |
| 4337 | */ |
| 4338 | if ((CUR == '/') && (NXT(1) == '>')) { |
| 4339 | SKIP(2); |
| 4340 | if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL)) |
| 4341 | ctxt->sax->endElement(ctxt->userData, name); |
| 4342 | htmlnamePop(ctxt); |
| 4343 | return; |
| 4344 | } |
| 4345 | |
| 4346 | if (CUR == '>') { |
| 4347 | NEXT; |
| 4348 | } else { |
| 4349 | htmlParseErr(ctxt, XML_ERR_GT_REQUIRED, |
| 4350 | "Couldn't find end of Start Tag %s\n", name, NULL); |
| 4351 | |
| 4352 | /* |
| 4353 | * end of parsing of this node. |
| 4354 | */ |
| 4355 | if (xmlStrEqual(name, ctxt->name)) { |
no test coverage detected