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

Function xmlGetID

ThirdParty/libxml2/vtklibxml2/valid.c:2570–2598  ·  view source on GitHub ↗

* xmlGetID: * @doc: pointer to the document * @ID: the ID value * * Search the attribute declaring the given ID * * Returns NULL if not found, otherwise the xmlAttrPtr defining the ID */

Source from the content-addressed store, hash-verified

2568 * Returns NULL if not found, otherwise the xmlAttrPtr defining the ID
2569 */
2570xmlAttrPtr
2571xmlGetID(xmlDocPtr doc, const xmlChar *ID) {
2572 xmlIDTablePtr table;
2573 xmlIDPtr id;
2574
2575 if (doc == NULL) {
2576 return(NULL);
2577 }
2578
2579 if (ID == NULL) {
2580 return(NULL);
2581 }
2582
2583 table = (xmlIDTablePtr) doc->ids;
2584 if (table == NULL)
2585 return(NULL);
2586
2587 id = xmlHashLookup(table, ID);
2588 if (id == NULL)
2589 return(NULL);
2590 if (id->attr == NULL) {
2591 /*
2592 * We are operating on a stream, return a well known reference
2593 * since the attribute node doesn't exist anymore
2594 */
2595 return((xmlAttrPtr) doc);
2596 }
2597 return(id->attr);
2598}
2599
2600/************************************************************************
2601 * *

Callers 2

xmlValidateRefFunction · 0.85
xmlXPathGetElementsByIdsFunction · 0.85

Calls 1

xmlHashLookupFunction · 0.85

Tested by

no test coverage detected