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

Function htmlParseEntityRef

Externals/LibXML/HTMLparser.c:2479–2515  ·  view source on GitHub ↗

* htmlParseEntityRef: * @ctxt: an HTML parser context * @str: location to store the entity name * * parse an HTML ENTITY references * * [68] EntityRef ::= '&' Name ';' * * Returns the associated htmlEntityDescPtr if found, or NULL otherwise, * if non-NULL *str will have to be freed by the caller. */

Source from the content-addressed store, hash-verified

2477 * if non-NULL *str will have to be freed by the caller.
2478 */
2479const htmlEntityDesc *
2480htmlParseEntityRef(htmlParserCtxtPtr ctxt, const xmlChar **str) {
2481 const xmlChar *name;
2482 const htmlEntityDesc * ent = NULL;
2483
2484 if (str != NULL) *str = NULL;
2485 if ((ctxt == NULL) || (ctxt->input == NULL)) return(NULL);
2486
2487 if (CUR == '&') {
2488 NEXT;
2489 name = htmlParseName(ctxt);
2490 if (name == NULL) {
2491 htmlParseErr(ctxt, XML_ERR_NAME_REQUIRED,
2492 "htmlParseEntityRef: no name\n", NULL, NULL);
2493 } else {
2494 GROW;
2495 if (CUR == ';') {
2496 if (str != NULL)
2497 *str = name;
2498
2499 /*
2500 * Lookup the entity in the table.
2501 */
2502 ent = htmlEntityLookup(name);
2503 if (ent != NULL) /* OK that's ugly !!! */
2504 NEXT;
2505 } else {
2506 htmlParseErr(ctxt, XML_ERR_ENTITYREF_SEMICOL_MISSING,
2507 "htmlParseEntityRef: expecting ';'\n",
2508 NULL, NULL);
2509 if (str != NULL)
2510 *str = name;
2511 }
2512 }
2513 }
2514 return(ent);
2515}
2516
2517/**
2518 * htmlParseAttValue:

Callers 3

test_htmlParseEntityRefFunction · 0.85
htmlParseHTMLAttributeFunction · 0.85
htmlParseReferenceFunction · 0.85

Calls 3

htmlParseNameFunction · 0.85
htmlParseErrFunction · 0.85
htmlEntityLookupFunction · 0.85

Tested by 1

test_htmlParseEntityRefFunction · 0.68