+ if (tmp_size > 1) {
+ WARNING("curl_xml plugin: "
+ "relative xpath expression for 'PluginInstanceFrom' \"%s\" "
+ "is expected to return only one text node. Skipping the node.",
+ xpath->plugin_instance_from);
+ xmlXPathFreeObject(instance_node_obj);
+ return -1;
+ }
+
+ /* ignoring the element if other than textnode/attribute */
+ if (cx_if_not_text_node(instance_node->nodeTab[0])) {
+ WARNING("curl_xml plugin: "
+ "relative xpath expression \"%s\" is expected to return only "
+ "text node which is not the case. Skipping the node.",
+ xpath->plugin_instance_from);
+ xmlXPathFreeObject(instance_node_obj);
+ return -1;
+ }
+
+ if (instance_node != NULL) {
+ char *node_value = (char *)xmlNodeGetContent(instance_node->nodeTab[0]);
+ sstrncpy(vl->plugin_instance, node_value, sizeof(vl->plugin_instance));
+ sfree(node_value);
+ }
+
+ /* Free `instance_node_obj' this late, because `instance_node' points to
+ * somewhere inside this structure. */
+ xmlXPathFreeObject(instance_node_obj);
+ } /* if (xpath->plugin_instance_from != NULL) */
+
+ return 0;
+} /* }}} int cx_handle_instance_xpath */
+
+static int cx_handle_xpath(const cx_t *db, /* {{{ */
+ xmlXPathContextPtr xpath_ctx, cx_xpath_t *xpath) {
+
+ const data_set_t *ds = plugin_get_ds(xpath->type);
+ if (cx_check_type(ds, xpath) != 0)
+ return -1;
+
+ xmlXPathObjectPtr base_node_obj = cx_evaluate_xpath(xpath_ctx, xpath->path);