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

Function xmlParseEntityDecl

ThirdParty/libxml2/vtklibxml2/parser.c:5697–5913  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5695 */
5696
5697void
5698xmlParseEntityDecl(xmlParserCtxtPtr ctxt) {
5699 const xmlChar *name = NULL;
5700 xmlChar *value = NULL;
5701 xmlChar *URI = NULL, *literal = NULL;
5702 const xmlChar *ndata = NULL;
5703 int isParameter = 0;
5704 xmlChar *orig = NULL;
5705
5706 if ((CUR != '<') || (NXT(1) != '!'))
5707 return;
5708 SKIP(2);
5709
5710 /* GROW; done in the caller */
5711 if (CMP6(CUR_PTR, 'E', 'N', 'T', 'I', 'T', 'Y')) {
5712 int inputid = ctxt->input->id;
5713 SKIP(6);
5714 if (SKIP_BLANKS_PE == 0) {
5715 xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
5716 "Space required after '<!ENTITY'\n");
5717 }
5718
5719 if (RAW == '%') {
5720 NEXT;
5721 if (SKIP_BLANKS_PE == 0) {
5722 xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
5723 "Space required after '%%'\n");
5724 }
5725 isParameter = 1;
5726 }
5727
5728 name = xmlParseName(ctxt);
5729 if (name == NULL) {
5730 xmlFatalErrMsg(ctxt, XML_ERR_NAME_REQUIRED,
5731 "xmlParseEntityDecl: no name\n");
5732 return;
5733 }
5734 if (xmlStrchr(name, ':') != NULL) {
5735 xmlNsErr(ctxt, XML_NS_ERR_COLON,
5736 "colons are forbidden from entities names '%s'\n",
5737 name, NULL, NULL);
5738 }
5739 if (SKIP_BLANKS_PE == 0) {
5740 xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
5741 "Space required after the entity name\n");
5742 }
5743
5744 /*
5745 * handle the various case of definitions...
5746 */
5747 if (isParameter) {
5748 if ((RAW == '"') || (RAW == '\'')) {
5749 value = xmlParseEntityValue(ctxt, &orig);
5750 if (value) {
5751 if ((ctxt->sax != NULL) &&
5752 (!ctxt->disableSAX) && (ctxt->sax->entityDecl != NULL))
5753 ctxt->sax->entityDecl(ctxt->userData, name,
5754 XML_INTERNAL_PARAMETER_ENTITY,

Callers 1

xmlParseMarkupDeclFunction · 0.85

Calls 12

xmlParseNameFunction · 0.85
xmlStrchrFunction · 0.85
xmlParseEntityValueFunction · 0.85
xmlParseExternalIDFunction · 0.85
xmlFatalErrFunction · 0.85
xmlStrEqualFunction · 0.85
xmlNewDocFunction · 0.85
xmlErrMemoryFunction · 0.85
xmlNewDtdFunction · 0.85
xmlSAX2EntityDeclFunction · 0.85
xmlHaltParserFunction · 0.85
xmlSAX2GetEntityFunction · 0.85

Tested by

no test coverage detected