* htmlParseEntityRef: * @ctxt: an HTML parser context * @str: location to store the entity name * * DEPRECATED: Internal function, don't use. * * 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. */
| 2778 | * if non-NULL *str will have to be freed by the caller. |
| 2779 | */ |
| 2780 | const htmlEntityDesc * |
| 2781 | htmlParseEntityRef(htmlParserCtxtPtr ctxt, const xmlChar **str) { |
| 2782 | const xmlChar *name; |
| 2783 | const htmlEntityDesc * ent = NULL; |
| 2784 | |
| 2785 | if (str != NULL) *str = NULL; |
| 2786 | if ((ctxt == NULL) || (ctxt->input == NULL)) return(NULL); |
| 2787 | |
| 2788 | if (CUR == '&') { |
| 2789 | NEXT; |
| 2790 | name = htmlParseName(ctxt); |
| 2791 | if (name == NULL) { |
| 2792 | htmlParseErr(ctxt, XML_ERR_NAME_REQUIRED, |
| 2793 | "htmlParseEntityRef: no name\n", NULL, NULL); |
| 2794 | } else { |
| 2795 | GROW; |
| 2796 | if (CUR == ';') { |
| 2797 | if (str != NULL) |
| 2798 | *str = name; |
| 2799 | |
| 2800 | /* |
| 2801 | * Lookup the entity in the table. |
| 2802 | */ |
| 2803 | ent = htmlEntityLookup(name); |
| 2804 | if (ent != NULL) /* OK that's ugly !!! */ |
| 2805 | NEXT; |
| 2806 | } else { |
| 2807 | htmlParseErr(ctxt, XML_ERR_ENTITYREF_SEMICOL_MISSING, |
| 2808 | "htmlParseEntityRef: expecting ';'\n", |
| 2809 | NULL, NULL); |
| 2810 | if (str != NULL) |
| 2811 | *str = name; |
| 2812 | } |
| 2813 | } |
| 2814 | } |
| 2815 | return(ent); |
| 2816 | } |
| 2817 | |
| 2818 | /** |
| 2819 | * htmlParseAttValue: |
no test coverage detected