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

Function xmlAddID

ThirdParty/libxml2/vtklibxml2/valid.c:2416–2442  ·  view source on GitHub ↗

* xmlAddID: * @ctxt: the validation context * @doc: pointer to the document * @value: the value name * @attr: the attribute holding the ID * * Register a new id declaration * * Returns NULL if not, otherwise the new xmlIDPtr */

Source from the content-addressed store, hash-verified

2414 * Returns NULL if not, otherwise the new xmlIDPtr
2415 */
2416xmlIDPtr
2417xmlAddID(xmlValidCtxtPtr ctxt, xmlDocPtr doc, const xmlChar *value,
2418 xmlAttrPtr attr) {
2419 xmlIDPtr id;
2420 int res;
2421
2422 if ((attr == NULL) || (doc != attr->doc))
2423 return(NULL);
2424
2425 res = xmlAddIDInternal(attr, value, &id);
2426 if (res < 0) {
2427 xmlVErrMemory(ctxt);
2428 }
2429#ifdef LIBXML_VALID_ENABLED
2430 else if (res == 0) {
2431 if (ctxt != NULL) {
2432 /*
2433 * The id is already defined in this DTD.
2434 */
2435 xmlErrValidNode(ctxt, attr->parent, XML_DTD_ID_REDEFINED,
2436 "ID %s already defined\n", value, NULL, NULL);
2437 }
2438 }
2439#endif /* LIBXML_VALID_ENABLED */
2440
2441 return(id);
2442}
2443
2444static void
2445xmlFreeIDTableEntry(void *id, const xmlChar *name ATTRIBUTE_UNUSED) {

Callers 4

xmlValidateOneAttributeFunction · 0.85
xmlValidateOneNamespaceFunction · 0.85
SAX2.cFile · 0.85
xmlSAX2AttributeNsFunction · 0.85

Calls 2

xmlAddIDInternalFunction · 0.85
xmlVErrMemoryFunction · 0.85

Tested by

no test coverage detected