MCPcopy Create free account
hub / github.com/Kitware/VTK / htmlParseContentInternal

Function htmlParseContentInternal

ThirdParty/libxml2/vtklibxml2/HTMLparser.c:4529–4722  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4527 */
4528
4529static void
4530htmlParseContentInternal(htmlParserCtxtPtr ctxt) {
4531 xmlChar *currentNode;
4532 int depth;
4533 const xmlChar *name;
4534
4535 depth = ctxt->nameNr;
4536 if (depth <= 0) {
4537 currentNode = NULL;
4538 } else {
4539 currentNode = xmlStrdup(ctxt->name);
4540 if (currentNode == NULL) {
4541 htmlErrMemory(ctxt);
4542 return;
4543 }
4544 }
4545 while (PARSER_STOPPED(ctxt) == 0) {
4546 GROW;
4547
4548 /*
4549 * Our tag or one of it's parent or children is ending.
4550 */
4551 if ((CUR == '<') && (NXT(1) == '/')) {
4552 if (htmlParseEndTag(ctxt) &&
4553 ((currentNode != NULL) || (ctxt->nameNr == 0))) {
4554 if (currentNode != NULL)
4555 xmlFree(currentNode);
4556
4557 depth = ctxt->nameNr;
4558 if (depth <= 0) {
4559 currentNode = NULL;
4560 } else {
4561 currentNode = xmlStrdup(ctxt->name);
4562 if (currentNode == NULL) {
4563 htmlErrMemory(ctxt);
4564 break;
4565 }
4566 }
4567 }
4568 continue; /* while */
4569 }
4570
4571 else if ((CUR == '<') &&
4572 ((IS_ASCII_LETTER(NXT(1))) ||
4573 (NXT(1) == '_') || (NXT(1) == ':'))) {
4574 name = htmlParseHTMLName_nonInvasive(ctxt);
4575 if (name == NULL) {
4576 htmlParseErr(ctxt, XML_ERR_NAME_REQUIRED,
4577 "htmlParseStartTag: invalid element name\n",
4578 NULL, NULL);
4579 /* Dump the bogus tag like browsers do */
4580 while ((CUR == 0) && (CUR != '>'))
4581 NEXT;
4582
4583 htmlParserFinishElementParsing(ctxt);
4584 if (currentNode != NULL)
4585 xmlFree(currentNode);
4586

Callers 2

__htmlParseContentFunction · 0.85
htmlParseDocumentFunction · 0.85

Calls 15

xmlStrdupFunction · 0.85
htmlErrMemoryFunction · 0.85
htmlParseEndTagFunction · 0.85
htmlCheckAutoCloseFunction · 0.85
htmlAutoCloseFunction · 0.85
xmlStrEqualFunction · 0.85
htmlParseScriptFunction · 0.85
htmlParseDocTypeDeclFunction · 0.85
htmlParseCommentFunction · 0.85
htmlSkipBogusCommentFunction · 0.85

Tested by

no test coverage detected