This source file includes following definitions.
- crm_element_name
- numXpathResults
1
2
3
4
5
6
7
8
9
10 #ifndef PCMK__CRM_COMMON_XML_COMPAT__H
11 #define PCMK__CRM_COMMON_XML_COMPAT__H
12
13 #include <glib.h>
14 #include <libxml/tree.h>
15 #include <libxml/xpath.h>
16
17 #include <crm/common/nvpair.h>
18 #include <crm/common/xml_names.h>
19
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23
24
25
26
27
28
29
30
31
32
33
34
35 static inline const char *
36 crm_element_name(const xmlNode *xml)
37 {
38 return (xml == NULL)? NULL : (const char *) xml->name;
39 }
40
41
42
43 xmlNode *copy_xml(xmlNode *src_node);
44
45
46
47 gboolean cli_config_update(xmlNode **xml, int *best_version, gboolean to_logs);
48
49
50
51 void crm_xml_init(void);
52
53
54 void crm_xml_cleanup(void);
55
56
57 void pcmk_free_xml_subtree(xmlNode *xml);
58
59
60
61 void free_xml(xmlNode *child);
62
63
64 void crm_xml_sanitize_id(char *id);
65
66
67 char *calculate_on_disk_digest(xmlNode *input);
68
69
70 char *calculate_operation_digest(xmlNode *input, const char *version);
71
72
73 char *calculate_xml_versioned_digest(xmlNode *input, gboolean sort,
74 gboolean do_filter, const char *version);
75
76
77 xmlXPathObjectPtr xpath_search(const xmlNode *xml_top, const char *path);
78
79
80 static inline int numXpathResults(xmlXPathObjectPtr xpathObj)
81 {
82 if ((xpathObj == NULL) || (xpathObj->nodesetval == NULL)) {
83 return 0;
84 }
85 return xpathObj->nodesetval->nodeNr;
86 }
87
88
89 xmlNode *getXpathResult(xmlXPathObjectPtr xpathObj, int index);
90
91
92 void freeXpathObject(xmlXPathObjectPtr xpathObj);
93
94
95 void dedupXpathResults(xmlXPathObjectPtr xpathObj);
96
97
98 void crm_foreach_xpath_result(xmlNode *xml, const char *xpath,
99 void (*helper)(xmlNode*, void*), void *user_data);
100
101
102
103 xmlNode *get_xpath_object(const char *xpath, xmlNode *xml_obj, int error_level);
104
105
106 typedef const xmlChar *pcmkXmlStr;
107
108
109 bool xml_tracking_changes(xmlNode *xml);
110
111
112 bool xml_document_dirty(xmlNode *xml);
113
114
115 void xml_accept_changes(xmlNode *xml);
116
117
118 void xml_track_changes(xmlNode *xml, const char *user, xmlNode *acl_source,
119 bool enforce_acls);
120
121
122 void xml_calculate_changes(xmlNode *old_xml, xmlNode *new_xml);
123
124
125 void xml_calculate_significant_changes(xmlNode *old_xml, xmlNode *new_xml);
126
127 #ifdef __cplusplus
128 }
129 #endif
130
131 #endif