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

Function xmlGetPropNodeInternal

ThirdParty/libxml2/vtklibxml2/tree.c:6528–6657  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6526#endif /* LIBXML_TREE_ENABLED */
6527
6528static xmlAttrPtr
6529xmlGetPropNodeInternal(const xmlNode *node, const xmlChar *name,
6530 const xmlChar *nsName, int useDTD)
6531{
6532 xmlAttrPtr prop;
6533
6534 /* Avoid unused variable warning if features are disabled. */
6535 (void) useDTD;
6536
6537 if ((node == NULL) || (node->type != XML_ELEMENT_NODE) || (name == NULL))
6538 return(NULL);
6539
6540 if (node->properties != NULL) {
6541 prop = node->properties;
6542 if (nsName == NULL) {
6543 /*
6544 * We want the attr to be in no namespace.
6545 */
6546 do {
6547 if ((prop->ns == NULL) && xmlStrEqual(prop->name, name)) {
6548 return(prop);
6549 }
6550 prop = prop->next;
6551 } while (prop != NULL);
6552 } else {
6553 /*
6554 * We want the attr to be in the specified namespace.
6555 */
6556 do {
6557 if ((prop->ns != NULL) && xmlStrEqual(prop->name, name) &&
6558 ((prop->ns->href == nsName) ||
6559 xmlStrEqual(prop->ns->href, nsName)))
6560 {
6561 return(prop);
6562 }
6563 prop = prop->next;
6564 } while (prop != NULL);
6565 }
6566 }
6567
6568#ifdef LIBXML_TREE_ENABLED
6569 if (! useDTD)
6570 return(NULL);
6571 /*
6572 * Check if there is a default/fixed attribute declaration in
6573 * the internal or external subset.
6574 */
6575 if ((node->doc != NULL) && (node->doc->intSubset != NULL)) {
6576 xmlDocPtr doc = node->doc;
6577 xmlAttributePtr attrDecl = NULL;
6578 xmlChar *elemQName, *tmpstr = NULL;
6579
6580 /*
6581 * We need the QName of the element for the DTD-lookup.
6582 */
6583 if ((node->ns != NULL) && (node->ns->prefix != NULL)) {
6584 tmpstr = xmlStrdup(node->ns->prefix);
6585 if (tmpstr == NULL)

Callers 8

xmlInsertPropFunction · 0.85
xmlHasNsPropFunction · 0.85
xmlNodeGetAttrValueFunction · 0.85
xmlGetNoNsPropFunction · 0.85
xmlGetNsPropFunction · 0.85
xmlUnsetPropFunction · 0.85
xmlUnsetNsPropFunction · 0.85
xmlSetNsPropFunction · 0.85

Calls 5

xmlStrEqualFunction · 0.85
xmlStrdupFunction · 0.85
xmlStrcatFunction · 0.85
xmlGetDtdQAttrDescFunction · 0.85
xmlGetNsListFunction · 0.85

Tested by

no test coverage detected