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

Function xmlParseEnumerationType

ThirdParty/libxml2/vtklibxml2/parser.c:6069–6121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6067 */
6068
6069xmlEnumerationPtr
6070xmlParseEnumerationType(xmlParserCtxtPtr ctxt) {
6071 xmlChar *name;
6072 xmlEnumerationPtr ret = NULL, last = NULL, cur, tmp;
6073
6074 if (RAW != '(') {
6075 xmlFatalErr(ctxt, XML_ERR_ATTLIST_NOT_STARTED, NULL);
6076 return(NULL);
6077 }
6078 do {
6079 NEXT;
6080 SKIP_BLANKS_PE;
6081 name = xmlParseNmtoken(ctxt);
6082 if (name == NULL) {
6083 xmlFatalErr(ctxt, XML_ERR_NMTOKEN_REQUIRED, NULL);
6084 return(ret);
6085 }
6086 tmp = ret;
6087 while (tmp != NULL) {
6088 if (xmlStrEqual(name, tmp->name)) {
6089 xmlValidityError(ctxt, XML_DTD_DUP_TOKEN,
6090 "standalone: attribute enumeration value token %s duplicated\n",
6091 name, NULL);
6092 if (!xmlDictOwns(ctxt->dict, name))
6093 xmlFree(name);
6094 break;
6095 }
6096 tmp = tmp->next;
6097 }
6098 if (tmp == NULL) {
6099 cur = xmlCreateEnumeration(name);
6100 if (!xmlDictOwns(ctxt->dict, name))
6101 xmlFree(name);
6102 if (cur == NULL) {
6103 xmlErrMemory(ctxt);
6104 xmlFreeEnumeration(ret);
6105 return(NULL);
6106 }
6107 if (last == NULL) ret = last = cur;
6108 else {
6109 last->next = cur;
6110 last = cur;
6111 }
6112 }
6113 SKIP_BLANKS_PE;
6114 } while (RAW == '|');
6115 if (RAW != ')') {
6116 xmlFatalErr(ctxt, XML_ERR_ATTLIST_NOT_FINISHED, NULL);
6117 return(ret);
6118 }
6119 NEXT;
6120 return(ret);
6121}
6122
6123/**
6124 * xmlParseEnumeratedType:

Callers 1

xmlParseEnumeratedTypeFunction · 0.85

Calls 7

xmlFatalErrFunction · 0.85
xmlParseNmtokenFunction · 0.85
xmlStrEqualFunction · 0.85
xmlDictOwnsFunction · 0.85
xmlCreateEnumerationFunction · 0.85
xmlErrMemoryFunction · 0.85
xmlFreeEnumerationFunction · 0.85

Tested by

no test coverage detected