This source file includes following definitions.
- numXpathResults
1
2
3
4
5
6
7
8
9
10 #ifndef PCMK__CRM_COMMON_XML__H
11 #define PCMK__CRM_COMMON_XML__H
12
13
14 #include <stdio.h>
15 #include <sys/types.h>
16 #include <unistd.h>
17
18 #include <stdlib.h>
19 #include <errno.h>
20 #include <fcntl.h>
21
22 #include <libxml/tree.h>
23 #include <libxml/xpath.h>
24
25 #include <crm/crm.h>
26 #include <crm/common/nvpair.h>
27 #include <crm/common/schemas.h>
28 #include <crm/common/xml_io.h>
29 #include <crm/common/xml_names.h>
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34
35
36
37
38
39
40
41 typedef const xmlChar *pcmkXmlStr;
42
43
44
45
46
47
48
49 xmlNode *get_xpath_object(const char *xpath, xmlNode * xml_obj, int error_level);
50
51 xmlXPathObjectPtr xpath_search(const xmlNode *xml_top, const char *path);
52 void crm_foreach_xpath_result(xmlNode *xml, const char *xpath,
53 void (*helper)(xmlNode*, void*), void *user_data);
54
55 void freeXpathObject(xmlXPathObjectPtr xpathObj);
56 xmlNode *getXpathResult(xmlXPathObjectPtr xpathObj, int index);
57 void dedupXpathResults(xmlXPathObjectPtr xpathObj);
58
59 static inline int numXpathResults(xmlXPathObjectPtr xpathObj)
60 {
61 if(xpathObj == NULL || xpathObj->nodesetval == NULL) {
62 return 0;
63 }
64 return xpathObj->nodesetval->nodeNr;
65 }
66
67 bool xml_tracking_changes(xmlNode * xml);
68 bool xml_document_dirty(xmlNode *xml);
69 void xml_track_changes(xmlNode * xml, const char *user, xmlNode *acl_source, bool enforce_acls);
70 void xml_calculate_changes(xmlNode *old_xml, xmlNode *new_xml);
71 void xml_calculate_significant_changes(xmlNode *old_xml, xmlNode *new_xml);
72 void xml_accept_changes(xmlNode * xml);
73 bool xml_patch_versions(const xmlNode *patchset, int add[3], int del[3]);
74
75 xmlNode *xml_create_patchset(
76 int format, xmlNode *source, xmlNode *target, bool *config, bool manage_version);
77 int xml_apply_patchset(xmlNode *xml, xmlNode *patchset, bool check_version);
78
79 void patchset_process_digest(xmlNode *patch, xmlNode *source, xmlNode *target, bool with_digest);
80
81 #ifdef __cplusplus
82 }
83 #endif
84
85 #if !defined(PCMK_ALLOW_DEPRECATED) || (PCMK_ALLOW_DEPRECATED == 1)
86 #include <crm/common/xml_compat.h>
87 #endif
88
89 #endif