10 #ifndef PCMK__CRM_COMMON_XML__H 11 # define PCMK__CRM_COMMON_XML__H 15 # include <sys/types.h> 22 # include <libxml/tree.h> 23 # include <libxml/xpath.h> 46 # define CRM_BZ2_BLOCKS 4 47 # define CRM_BZ2_WORK 20 48 # define CRM_BZ2_THRESHOLD 128 * 1024 52 gboolean
add_message_xml(xmlNode * msg,
const char *field, xmlNode * xml);
104 const char *class_name,
const char *text);
115 xmlNode *
copy_xml(xmlNode * src_node);
120 xmlNode *
add_node_copy(xmlNode * new_parent, xmlNode * xml_node);
133 int write_xml_fd(
const xmlNode *xml,
const char *filename,
int fd,
135 int write_xml_file(
const xmlNode *xml,
const char *filename, gboolean compress);
144 xmlNode *
diff_xml_object(xmlNode * left, xmlNode * right, gboolean suppress);
147 gboolean full, gboolean * changed,
const char *marker);
154 xmlNode *
find_xml_node(
const xmlNode *root,
const char *search_path,
160 gboolean delete_only);
165 const char *tag,
const char *field,
const char *value,
166 gboolean search_matches);
168 xmlNode *
get_xpath_object(
const char *xpath, xmlNode * xml_obj,
int error_level);
171 static inline const char *
172 crm_map_element_name(
const xmlNode *xml)
176 }
else if (strcmp((
const char *) xml->name,
"master") == 0) {
179 return (
const char *) xml->name;
189 gboolean
validate_xml(xmlNode * xml_blob,
const char *validation, gboolean to_logs);
230 gboolean transform, gboolean to_logs);
254 void (*helper)(xmlNode*,
void*),
void *user_data);
261 static inline int numXpathResults(xmlXPathObjectPtr xpathObj)
263 if(xpathObj == NULL || xpathObj->nodesetval == NULL) {
266 return xpathObj->nodesetval->nodeNr;
271 void xml_track_changes(xmlNode * xml,
const char *user, xmlNode *acl_source,
bool enforce_acls);
278 int format, xmlNode *source, xmlNode *
target,
bool *config,
bool manage_version);
284 const char *filename);
288 void crm_xml_set_id(xmlNode *xml,
const char *format, ...) G_GNUC_PRINTF(2, 3);
290 #if !defined(PCMK_ALLOW_DEPRECATED) || (PCMK_ALLOW_DEPRECATED == 1) xmlNode * get_xpath_object_relative(const char *xpath, xmlNode *xml_obj, int error_level)
xmlNode * first_named_child(const xmlNode *parent, const char *name)
void crm_xml_cleanup(void)
xmlNode * pcmk_create_html_node(xmlNode *parent, const char *element_name, const char *id, const char *class_name, const char *text)
void copy_in_properties(xmlNode *target, const xmlNode *src)
xmlNode * find_xml_node(const xmlNode *root, const char *search_path, gboolean must_find)
void xml_track_changes(xmlNode *xml, const char *user, xmlNode *acl_source, bool enforce_acls)
void crm_xml_init(void)
Initialize the CRM XML subsystem.
int write_xml_file(const xmlNode *xml, const char *filename, gboolean compress)
Write XML to a file.
int get_schema_version(const char *name)
gboolean validate_xml_verbose(const xmlNode *xml_blob)
void xml_accept_changes(xmlNode *xml)
xmlNode * filename2xml(const char *filename)
void dedupXpathResults(xmlXPathObjectPtr xpathObj)
void purge_diff_markers(xmlNode *a_node)
xmlNode * get_xpath_object(const char *xpath, xmlNode *xml_obj, int error_level)
Deprecated Pacemaker XML API.
xmlNode * string2xml(const char *input)
void crm_xml_sanitize_id(char *id)
Sanitize a string so it is usable as an XML ID.
gboolean validate_xml(xmlNode *xml_blob, const char *validation, gboolean to_logs)
void expand_plus_plus(xmlNode *target, const char *name, const char *value)
Update current XML attribute value per parsed integer assignment statement.
bool xml_tracking_changes(xmlNode *xml)
xmlNode * copy_xml(xmlNode *src_node)
char * calculate_operation_digest(xmlNode *local_cib, const char *version)
Calculate and return digest of XML operation.
xmlNode * stdin2xml(void)
void pcmk_free_xml_subtree(xmlNode *xml)
int xml_apply_patchset(xmlNode *xml, xmlNode *patchset, bool check_version)
char * dump_xml_unformatted(const xmlNode *xml)
gboolean update_xml_child(xmlNode *child, xmlNode *to_update)
xmlNode * pcmk_create_xml_text_node(xmlNode *parent, const char *name, const char *content)
xmlNode * add_node_copy(xmlNode *new_parent, xmlNode *xml_node)
void crm_xml_set_id(xmlNode *xml, const char *format,...) G_GNUC_PRINTF(2
xmlNode * expand_idref(xmlNode *input, xmlNode *top)
bool xml_document_dirty(xmlNode *xml)
xmlNode * create_xml_node(xmlNode *parent, const char *name)
gboolean add_message_xml(xmlNode *msg, const char *field, xmlNode *xml)
void free_xml(xmlNode *child)
xmlNode * get_message_xml(const xmlNode *msg, const char *field)
char * calculate_on_disk_digest(xmlNode *local_cib)
Calculate and return digest of XML tree, suitable for storing on disk.
xmlNode * sorted_xml(xmlNode *input, xmlNode *parent, gboolean recursive)
const char * xml_latest_schema(void)
void patchset_process_digest(xmlNode *patch, xmlNode *source, xmlNode *target, bool with_digest)
const xmlChar * pcmkXmlStr
Functionality for manipulating name/value pairs.
char * dump_xml_formatted_with_text(const xmlNode *xml)
int find_xml_children(xmlNode **children, xmlNode *root, const char *tag, const char *field, const char *value, gboolean search_matches)
int write_xml_fd(const xmlNode *xml, const char *filename, int fd, gboolean compress)
Write XML to a file descriptor.
xmlXPathObjectPtr xpath_search(const xmlNode *xml_top, const char *path)
void save_xml_to_file(const xmlNode *xml, const char *desc, const char *filename)
void xml_remove_prop(xmlNode *obj, const char *name)
xmlNode * getXpathResult(xmlXPathObjectPtr xpathObj, int index)
char * calculate_xml_versioned_digest(xmlNode *input, gboolean sort, gboolean do_filter, const char *version)
Calculate and return digest of XML tree.
gboolean can_prune_leaf(xmlNode *xml_node)
void crm_foreach_xpath_result(xmlNode *xml, const char *xpath, void(*helper)(xmlNode *, void *), void *user_data)
Run a supplied function for each result of an xpath search.
int update_validation(xmlNode **xml_blob, int *best, int max, gboolean transform, gboolean to_logs)
Update CIB XML to most recent schema version.
xmlNode * diff_xml_object(xmlNode *left, xmlNode *right, gboolean suppress)
char * dump_xml_formatted(const xmlNode *xml)
bool xml_patch_versions(const xmlNode *patchset, int add[3], int del[3])
xmlNode * subtract_xml_object(xmlNode *parent, xmlNode *left, xmlNode *right, gboolean full, gboolean *changed, const char *marker)
void xml_calculate_significant_changes(xmlNode *old_xml, xmlNode *new_xml)
char * crm_xml_escape(const char *text)
Replace special characters with their XML escape sequences.
gboolean cli_config_update(xmlNode **xml, int *best_version, gboolean to_logs)
void fix_plus_plus_recursive(xmlNode *target)
Parse integer assignment statements on this node and all its child nodes.
void freeXpathObject(xmlXPathObjectPtr xpathObj)
xmlNode * xml_create_patchset(int format, xmlNode *source, xmlNode *target, bool *config, bool manage_version)
void xml_calculate_changes(xmlNode *old_xml, xmlNode *new_xml)
gboolean replace_xml_child(xmlNode *parent, xmlNode *child, xmlNode *update, gboolean delete_only)
const char * get_schema_name(int version)
xmlNode * crm_next_same_xml(const xmlNode *sibling)
Get next instance of same XML tag.