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

Function xmlAddElementDecl

ThirdParty/libxml2/vtklibxml2/valid.c:1144–1338  ·  view source on GitHub ↗

* xmlAddElementDecl: * @ctxt: the validation context * @dtd: pointer to the DTD * @name: the entity name * @type: the element type * @content: the element content tree or NULL * * Register a new element declaration * * Returns NULL if not, otherwise the entity */

Source from the content-addressed store, hash-verified

1142 * Returns NULL if not, otherwise the entity
1143 */
1144xmlElementPtr
1145xmlAddElementDecl(xmlValidCtxtPtr ctxt,
1146 xmlDtdPtr dtd, const xmlChar *name,
1147 xmlElementTypeVal type,
1148 xmlElementContentPtr content) {
1149 xmlElementPtr ret;
1150 xmlElementTablePtr table;
1151 xmlAttributePtr oldAttributes = NULL;
1152 const xmlChar *localName;
1153 xmlChar *prefix = NULL;
1154
1155 if (dtd == NULL) {
1156 return(NULL);
1157 }
1158 if (name == NULL) {
1159 return(NULL);
1160 }
1161
1162 switch (type) {
1163 case XML_ELEMENT_TYPE_EMPTY:
1164 if (content != NULL) {
1165 xmlErrValid(ctxt, XML_DTD_CONTENT_ERROR,
1166 "xmlAddElementDecl: content != NULL for EMPTY\n",
1167 NULL);
1168 return(NULL);
1169 }
1170 break;
1171 case XML_ELEMENT_TYPE_ANY:
1172 if (content != NULL) {
1173 xmlErrValid(ctxt, XML_DTD_CONTENT_ERROR,
1174 "xmlAddElementDecl: content != NULL for ANY\n",
1175 NULL);
1176 return(NULL);
1177 }
1178 break;
1179 case XML_ELEMENT_TYPE_MIXED:
1180 if (content == NULL) {
1181 xmlErrValid(ctxt, XML_DTD_CONTENT_ERROR,
1182 "xmlAddElementDecl: content == NULL for MIXED\n",
1183 NULL);
1184 return(NULL);
1185 }
1186 break;
1187 case XML_ELEMENT_TYPE_ELEMENT:
1188 if (content == NULL) {
1189 xmlErrValid(ctxt, XML_DTD_CONTENT_ERROR,
1190 "xmlAddElementDecl: content == NULL for ELEMENT\n",
1191 NULL);
1192 return(NULL);
1193 }
1194 break;
1195 default:
1196 xmlErrValid(ctxt, XML_ERR_ARGUMENT,
1197 "xmlAddElementDecl: invalid type\n", NULL);
1198 return(NULL);
1199 }
1200
1201 /*

Callers 1

xmlSAX2ElementDeclFunction · 0.85

Calls 9

xmlSplitQName4Function · 0.85
xmlHashCreateDictFunction · 0.85
xmlHashLookup2Function · 0.85
xmlHashRemoveEntry2Function · 0.85
xmlFreeElementFunction · 0.85
xmlStrdupFunction · 0.85
xmlHashAdd2Function · 0.85
xmlCopyDocElementContentFunction · 0.85
xmlVErrMemoryFunction · 0.85

Tested by

no test coverage detected