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

Function xmlHasProp

ThirdParty/libxml2/vtklibxml2/tree.c:6685–6721  ·  view source on GitHub ↗

* xmlHasProp: * @node: the node * @name: the attribute name * * Search an attribute associated to a node * This function also looks in DTD attribute declaration for #FIXED or * default declaration values. * * Returns the attribute or the attribute declaration or NULL if * neither was found. Also returns NULL if a memory allocation failed * making this function unreliable. */

Source from the content-addressed store, hash-verified

6683 * making this function unreliable.
6684 */
6685xmlAttrPtr
6686xmlHasProp(const xmlNode *node, const xmlChar *name) {
6687 xmlAttrPtr prop;
6688 xmlDocPtr doc;
6689
6690 if ((node == NULL) || (node->type != XML_ELEMENT_NODE) || (name == NULL))
6691 return(NULL);
6692 /*
6693 * Check on the properties attached to the node
6694 */
6695 prop = node->properties;
6696 while (prop != NULL) {
6697 if (xmlStrEqual(prop->name, name)) {
6698 return(prop);
6699 }
6700 prop = prop->next;
6701 }
6702
6703 /*
6704 * Check if there is a default declaration in the internal
6705 * or external subsets
6706 */
6707 doc = node->doc;
6708 if (doc != NULL) {
6709 xmlAttributePtr attrDecl;
6710 if (doc->intSubset != NULL) {
6711 attrDecl = xmlGetDtdAttrDesc(doc->intSubset, node->name, name);
6712 if ((attrDecl == NULL) && (doc->extSubset != NULL))
6713 attrDecl = xmlGetDtdAttrDesc(doc->extSubset, node->name, name);
6714 if ((attrDecl != NULL) && (attrDecl->defaultValue != NULL))
6715 /* return attribute declaration only if a default value is given
6716 (that includes #FIXED declarations) */
6717 return((xmlAttrPtr) attrDecl);
6718 }
6719 }
6720 return(NULL);
6721}
6722
6723/**
6724 * xmlHasNsProp:

Callers 5

xmlGetPropFunction · 0.85
xmlRelaxNGLoadIncludeFunction · 0.85
xmlRelaxNGCleanupTreeFunction · 0.85

Calls 2

xmlStrEqualFunction · 0.85
xmlGetDtdAttrDescFunction · 0.85

Tested by

no test coverage detected