* xmlParseStringEntityRef: * @ctxt: an XML parser context * @str: a pointer to an index in the string * * parse ENTITY references declarations, but this version parses it from * a string value. * * [68] EntityRef ::= '&' Name ';' * * [ WFC: Entity Declared ] * In a document without any DTD, a document with only an internal DTD * subset which contains no parameter entity references, or
| 7759 | * is updated to the current location in the string. |
| 7760 | */ |
| 7761 | static xmlChar * |
| 7762 | xmlParseStringEntityRef(xmlParserCtxtPtr ctxt, const xmlChar ** str) { |
| 7763 | xmlChar *name; |
| 7764 | const xmlChar *ptr; |
| 7765 | xmlChar cur; |
| 7766 | |
| 7767 | if ((str == NULL) || (*str == NULL)) |
| 7768 | return(NULL); |
| 7769 | ptr = *str; |
| 7770 | cur = *ptr; |
| 7771 | if (cur != '&') |
| 7772 | return(NULL); |
| 7773 | |
| 7774 | ptr++; |
| 7775 | name = xmlParseStringName(ctxt, &ptr); |
| 7776 | if (name == NULL) { |
| 7777 | xmlFatalErrMsg(ctxt, XML_ERR_NAME_REQUIRED, |
| 7778 | "xmlParseStringEntityRef: no name\n"); |
| 7779 | *str = ptr; |
| 7780 | return(NULL); |
| 7781 | } |
| 7782 | if (*ptr != ';') { |
| 7783 | xmlFatalErr(ctxt, XML_ERR_ENTITYREF_SEMICOL_MISSING, NULL); |
| 7784 | xmlFree(name); |
| 7785 | *str = ptr; |
| 7786 | return(NULL); |
| 7787 | } |
| 7788 | ptr++; |
| 7789 | |
| 7790 | *str = ptr; |
| 7791 | return(name); |
| 7792 | } |
| 7793 | |
| 7794 | /** |
| 7795 | * xmlParsePEReference: |
no test coverage detected