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

Function xmlSetProp

ThirdParty/libxml2/vtklibxml2/tree.c:6928–6955  ·  view source on GitHub ↗

* xmlSetProp: * @node: the node * @name: the attribute name (a QName) * @value: the attribute value * * Set (or reset) an attribute carried by a node. * If @name has a prefix, then the corresponding * namespace-binding will be used, if in scope; it is an * error it there's no such ns-binding for the prefix in * scope. * Returns the attribute pointer. * */

Source from the content-addressed store, hash-verified

6926 *
6927 */
6928xmlAttrPtr
6929xmlSetProp(xmlNodePtr node, const xmlChar *name, const xmlChar *value) {
6930 xmlNsPtr ns = NULL;
6931 const xmlChar *localname;
6932 xmlChar *prefix;
6933 int res;
6934
6935 if ((node == NULL) || (name == NULL) || (node->type != XML_ELEMENT_NODE))
6936 return(NULL);
6937
6938 /*
6939 * handle QNames
6940 */
6941 localname = xmlSplitQName4(name, &prefix);
6942 if (localname == NULL)
6943 return(NULL);
6944
6945 if (prefix != NULL) {
6946 res = xmlSearchNsSafe(node, prefix, &ns);
6947 xmlFree(prefix);
6948 if (res < 0)
6949 return(NULL);
6950 if (ns != NULL)
6951 return(xmlSetNsProp(node, ns, localname, value));
6952 }
6953
6954 return(xmlSetNsProp(node, NULL, name, value));
6955}
6956
6957/**
6958 * xmlSetNsProp:

Callers 10

xmlDumpXMLCatalogNodeFunction · 0.85
xmlParseCRNG_primaryFunction · 0.85
xmlParseCRNG_componentFunction · 0.85
htmlSetMetaEncodingFunction · 0.85
xmlRelaxNGLoadIncludeFunction · 0.85
xmlRelaxNGCleanupTreeFunction · 0.85
SetMethod · 0.85

Calls 3

xmlSplitQName4Function · 0.85
xmlSearchNsSafeFunction · 0.85
xmlSetNsPropFunction · 0.85

Tested by

no test coverage detected