MCPcopy Create free account
hub / github.com/ClusterLabs/pacemaker / xpath_search

Function xpath_search

lib/common/xml.c:2748–2769  ·  view source on GitHub ↗

the caller needs to check if the result contains a xmlDocPtr or xmlNodePtr */

Source from the content-addressed store, hash-verified

2746
2747/* the caller needs to check if the result contains a xmlDocPtr or xmlNodePtr */
2748xmlXPathObjectPtr
2749xpath_search(xmlNode *xml_top, const char *path)
2750{
2751 xmlDocPtr doc = NULL;
2752 xmlXPathObjectPtr xpathObj = NULL;
2753 xmlXPathContextPtr xpathCtx = NULL;
2754 const xmlChar *xpathExpr = (const xmlChar *)path;
2755
2756 CRM_CHECK(path != NULL, return NULL);
2757 CRM_CHECK(xml_top != NULL, return NULL);
2758 CRM_CHECK(strlen(path) > 0, return NULL);
2759
2760 doc = getDocPtr(xml_top);
2761
2762 crm_trace("Evaluating: %s", path);
2763 xpathCtx = xmlXPathNewContext(doc);
2764 CRM_ASSERT(xpathCtx != NULL);
2765
2766 xpathObj = xmlXPathEvalExpression(xpathExpr, xpathCtx);
2767 xmlXPathFreeContext(xpathCtx);
2768 return xpathObj;
2769}
2770
2771gboolean
2772cli_config_update(xmlNode **xml, int *best_version, gboolean to_logs)

Callers 15

crm_diff_updateFunction · 0.85
is_nodeid_requiredFunction · 0.85
get_on_target_actionsFunction · 0.85
fencing_topology_initFunction · 0.85
cib_stonith_devices_initFunction · 0.85
update_fencing_topologyFunction · 0.85
cib_config_changedFunction · 0.85
cib_process_xpathFunction · 0.85
search_xpath_objectsFunction · 0.85

Calls 1

getDocPtrFunction · 0.85

Tested by

no test coverage detected