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

Function xmlXPathNodeSetDupNs

ThirdParty/libxml2/vtklibxml2/xpath.c:2702–2736  ·  view source on GitHub ↗

* xmlXPathNodeSetDupNs: * @node: the parent node of the namespace XPath node * @ns: the libxml namespace declaration node. * * Namespace node in libxml don't match the XPath semantic. In a node set * the namespace nodes are duplicated and the next pointer is set to the * parent node in the XPath semantic. * * Returns the newly created object. */

Source from the content-addressed store, hash-verified

2700 * Returns the newly created object.
2701 */
2702static xmlNodePtr
2703xmlXPathNodeSetDupNs(xmlNodePtr node, xmlNsPtr ns) {
2704 xmlNsPtr cur;
2705
2706 if ((ns == NULL) || (ns->type != XML_NAMESPACE_DECL))
2707 return(NULL);
2708 if ((node == NULL) || (node->type == XML_NAMESPACE_DECL))
2709 return((xmlNodePtr) ns);
2710
2711 /*
2712 * Allocate a new Namespace and fill the fields.
2713 */
2714 cur = (xmlNsPtr) xmlMalloc(sizeof(xmlNs));
2715 if (cur == NULL)
2716 return(NULL);
2717 memset(cur, 0, sizeof(xmlNs));
2718 cur->type = XML_NAMESPACE_DECL;
2719 if (ns->href != NULL) {
2720 cur->href = xmlStrdup(ns->href);
2721 if (cur->href == NULL) {
2722 xmlFree(cur);
2723 return(NULL);
2724 }
2725 }
2726 if (ns->prefix != NULL) {
2727 cur->prefix = xmlStrdup(ns->prefix);
2728 if (cur->prefix == NULL) {
2729 xmlFree((xmlChar *) cur->href);
2730 xmlFree(cur);
2731 return(NULL);
2732 }
2733 }
2734 cur->next = (xmlNsPtr) node;
2735 return((xmlNodePtr) cur);
2736}
2737
2738/**
2739 * xmlXPathNodeSetFreeNs:

Callers 5

xmlXPathNodeSetCreateFunction · 0.85
xmlXPathNodeSetAddNsFunction · 0.85
xmlXPathNodeSetAddFunction · 0.85
xmlXPathNodeSetAddUniqueFunction · 0.85
xmlXPathNodeSetMergeFunction · 0.85

Calls 1

xmlStrdupFunction · 0.85

Tested by

no test coverage detected