This source file includes following definitions.
- crm_xml_add_boolean
- crm_element_name
- crm_map_element_name
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
16 #include <crm/common/nvpair.h>
17 #include <crm/common/xml_names.h>
18
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22
23
24
25
26
27
28
29
30
31
32
33 #define XML_PARANOIA_CHECKS 0
34
35
36 xmlDoc *getDocPtr(xmlNode *node);
37
38
39 int add_node_nocopy(xmlNode * parent, const char *name, xmlNode * child);
40
41
42 xmlNode *find_entity(xmlNode *parent, const char *node_name, const char *id);
43
44
45 char *xml_get_path(const xmlNode *xml);
46
47
48 void xml_log_changes(uint8_t level, const char *function, const xmlNode *xml);
49
50
51 void xml_log_patchset(uint8_t level, const char *function, const xmlNode *xml);
52
53
54 gboolean apply_xml_diff(xmlNode *old_xml, xmlNode *diff, xmlNode **new_xml);
55
56
57 void crm_destroy_xml(gpointer data);
58
59
60 gboolean xml_has_children(const xmlNode *root);
61
62
63 static inline const char *
64 crm_xml_add_boolean(xmlNode *node, const char *name, gboolean value)
65 {
66 return crm_xml_add(node, name, (value? "true" : "false"));
67 }
68
69
70
71 static inline const char *
72 crm_element_name(const xmlNode *xml)
73 {
74 return (xml == NULL)? NULL : (const char *) xml->name;
75 }
76
77
78 char *crm_xml_escape(const char *text);
79
80
81
82 xmlNode *copy_xml(xmlNode *src_node);
83
84
85 xmlNode *add_node_copy(xmlNode *new_parent, xmlNode *xml_node);
86
87
88 void purge_diff_markers(xmlNode *a_node);
89
90
91 xmlNode *diff_xml_object(xmlNode *left, xmlNode *right, gboolean suppress);
92
93
94 xmlNode *subtract_xml_object(xmlNode *parent, xmlNode *left, xmlNode *right,
95 gboolean full, gboolean *changed,
96 const char *marker);
97
98
99 gboolean can_prune_leaf(xmlNode *xml_node);
100
101
102 xmlNode *create_xml_node(xmlNode *parent, const char *name);
103
104
105 xmlNode *pcmk_create_xml_text_node(xmlNode *parent, const char *name,
106 const char *content);
107
108
109 xmlNode *pcmk_create_html_node(xmlNode *parent, const char *element_name,
110 const char *id, const char *class_name,
111 const char *text);
112
113
114 xmlNode *first_named_child(const xmlNode *parent, const char *name);
115
116
117 xmlNode *find_xml_node(const xmlNode *root, const char *search_path,
118 gboolean must_find);
119
120
121 xmlNode *crm_next_same_xml(const xmlNode *sibling);
122
123
124 void xml_remove_prop(xmlNode *obj, const char *name);
125
126
127 gboolean replace_xml_child(xmlNode *parent, xmlNode *child, xmlNode *update,
128 gboolean delete_only);
129
130
131 gboolean update_xml_child(xmlNode *child, xmlNode *to_update);
132
133
134 int find_xml_children(xmlNode **children, xmlNode *root, const char *tag,
135 const char *field, const char *value,
136 gboolean search_matches);
137
138
139 xmlNode *get_xpath_object_relative(const char *xpath, xmlNode *xml_obj,
140 int error_level);
141
142
143 void fix_plus_plus_recursive(xmlNode *target);
144
145
146 gboolean add_message_xml(xmlNode *msg, const char *field, xmlNode *xml);
147
148
149 xmlNode *get_message_xml(const xmlNode *msg, const char *field);
150
151
152 const char *xml_latest_schema(void);
153
154
155 const char *get_schema_name(int version);
156
157
158 int get_schema_version(const char *name);
159
160
161 int update_validation(xmlNode **xml_blob, int *best, int max,
162 gboolean transform, gboolean to_logs);
163
164
165 gboolean validate_xml(xmlNode *xml_blob, const char *validation,
166 gboolean to_logs);
167
168
169 gboolean validate_xml_verbose(const xmlNode *xml_blob);
170
171
172
173 gboolean cli_config_update(xmlNode **xml, int *best_version, gboolean to_logs);
174
175
176 static inline const char *
177 crm_map_element_name(const xmlNode *xml)
178 {
179 if (xml == NULL) {
180 return NULL;
181 } else if (strcmp((const char *) xml->name, "master") == 0) {
182
183 return PCMK_XE_CLONE;
184 } else {
185 return (const char *) xml->name;
186 }
187 }
188
189
190 void copy_in_properties(xmlNode *target, const xmlNode *src);
191
192
193 void expand_plus_plus(xmlNode * target, const char *name, const char *value);
194
195 #ifdef __cplusplus
196 }
197 #endif
198
199 #endif