pacemaker  2.1.8-3980678f03
Scalable High-Availability cluster resource manager
Macros | Functions
xml.c File Reference
#include <crm_internal.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <libxml/parser.h>
#include <libxml/tree.h>
#include <crm/crm.h>
#include <crm/common/xml.h>
#include <crm/common/xml_internal.h>
#include "crmcommon_private.h"
#include <crm/common/xml_compat.h>
Include dependency graph for xml.c:

Go to the source code of this file.

Macros

#define XML_DOC_PRIVATE_MAGIC   0x81726354UL
 
#define XML_NODE_PRIVATE_MAGIC   0x54637281UL
 
#define XPATH_MAX   512
 

Functions

bool pcmk__xml_tree_foreach (xmlNode *xml, bool(*fn)(xmlNode *, void *), void *user_data)
 
bool pcmk__tracking_xml_changes (xmlNode *xml, bool lazy)
 
void pcmk__set_xml_doc_flag (xmlNode *xml, enum xml_private_flags flag)
 
void pcmk__mark_xml_node_dirty (xmlNode *xml)
 
void pcmk__xml_mark_created (xmlNode *xml)
 
void xml_track_changes (xmlNode *xml, const char *user, xmlNode *acl_source, bool enforce_acls)
 
bool xml_tracking_changes (xmlNode *xml)
 
bool xml_document_dirty (xmlNode *xml)
 
int pcmk__xml_position (const xmlNode *xml, enum xml_private_flags ignore_if_set)
 
xmlNode * pcmk__xml_match (const xmlNode *haystack, const xmlNode *needle, bool exact)
 
void xml_accept_changes (xmlNode *xml)
 
xmlNode * pcmk__xe_first_child (const xmlNode *parent, const char *node_name, const char *attr_n, const char *attr_v)
 
int pcmk__xe_set_score (xmlNode *target, const char *name, const char *value)
 
int pcmk__xe_copy_attrs (xmlNode *target, const xmlNode *src, uint32_t flags)
 
void pcmk__xe_remove_attr (xmlNode *element, const char *name)
 
bool pcmk__xe_remove_attr_cb (xmlNode *xml, void *user_data)
 
void pcmk__xe_remove_matching_attrs (xmlNode *element, bool(*match)(xmlAttrPtr, void *), void *user_data)
 
xmlNode * pcmk__xe_create (xmlNode *parent, const char *name)
 
void pcmk__xe_set_content (xmlNode *node, const char *format,...)
 
void pcmk_free_xml_subtree (xmlNode *xml)
 
void free_xml (xmlNode *child)
 
xmlNode * pcmk__xml_copy (xmlNode *parent, xmlNode *src)
 
void pcmk__strip_xml_text (xmlNode *xml)
 
const char * pcmk__xe_add_last_written (xmlNode *xe)
 
void crm_xml_sanitize_id (char *id)
 Sanitize a string so it is usable as an XML ID. More...
 
void crm_xml_set_id (xmlNode *xml, const char *format,...)
 Set the ID of an XML element using a format. More...
 
bool pcmk__xml_needs_escape (const char *text, enum pcmk__xml_escape_type type)
 
gchar * pcmk__xml_escape (const char *text, enum pcmk__xml_escape_type type)
 
void xml_calculate_significant_changes (xmlNode *old_xml, xmlNode *new_xml)
 
void xml_calculate_changes (xmlNode *old_xml, xmlNode *new_xml)
 
xmlNode * pcmk__xc_match (const xmlNode *root, const xmlNode *search_comment, bool exact)
 
void pcmk__xc_update (xmlNode *parent, xmlNode *target, xmlNode *update)
 
void pcmk__xml_update (xmlNode *parent, xmlNode *target, xmlNode *update, uint32_t flags, bool as_diff)
 
int pcmk__xe_delete_match (xmlNode *xml, xmlNode *search)
 
int pcmk__xe_replace_match (xmlNode *xml, xmlNode *replace)
 
int pcmk__xe_update_match (xmlNode *xml, xmlNode *update, uint32_t flags)
 
xmlNode * sorted_xml (xmlNode *input, xmlNode *parent, gboolean recursive)
 
xmlNode * pcmk__xe_next_same (const xmlNode *node)
 
void crm_xml_init (void)
 Initialize the CRM XML subsystem. More...
 
void crm_xml_cleanup (void)
 
xmlNode * expand_idref (xmlNode *input, xmlNode *top)
 
char * pcmk__xml_artefact_root (enum pcmk__xml_artefact_ns ns)
 
char * pcmk__xml_artefact_path (enum pcmk__xml_artefact_ns ns, const char *filespec)
 
void pcmk__xe_set_propv (xmlNodePtr node, va_list pairs)
 
void pcmk__xe_set_props (xmlNodePtr node,...)
 
int pcmk__xe_foreach_child (xmlNode *xml, const char *child_element_name, int(*handler)(xmlNode *xml, void *userdata), void *userdata)
 
xmlNode * find_entity (xmlNode *parent, const char *node_name, const char *id)
 
void crm_destroy_xml (gpointer data)
 
xmlDoc * getDocPtr (xmlNode *node)
 
xmlNode * add_node_copy (xmlNode *parent, xmlNode *src_node)
 
int add_node_nocopy (xmlNode *parent, const char *name, xmlNode *child)
 
gboolean xml_has_children (const xmlNode *xml_root)
 
char * crm_xml_escape (const char *text)
 
xmlNode * copy_xml (xmlNode *src)
 
xmlNode * create_xml_node (xmlNode *parent, const char *name)
 
xmlNode * pcmk_create_xml_text_node (xmlNode *parent, const char *name, const char *content)
 
xmlNode * pcmk_create_html_node (xmlNode *parent, const char *element_name, const char *id, const char *class_name, const char *text)
 
xmlNode * first_named_child (const xmlNode *parent, const char *name)
 
xmlNode * find_xml_node (const xmlNode *root, const char *search_path, gboolean must_find)
 
xmlNode * crm_next_same_xml (const xmlNode *sibling)
 
void xml_remove_prop (xmlNode *obj, const char *name)
 
gboolean replace_xml_child (xmlNode *parent, xmlNode *child, xmlNode *update, gboolean delete_only)
 
gboolean update_xml_child (xmlNode *child, xmlNode *to_update)
 
int find_xml_children (xmlNode **children, xmlNode *root, const char *tag, const char *field, const char *value, gboolean search_matches)
 
void fix_plus_plus_recursive (xmlNode *target)
 
void copy_in_properties (xmlNode *target, const xmlNode *src)
 
void expand_plus_plus (xmlNode *target, const char *name, const char *value)
 

Macro Definition Documentation

◆ XML_DOC_PRIVATE_MAGIC

#define XML_DOC_PRIVATE_MAGIC   0x81726354UL

Definition at line 175 of file xml.c.

◆ XML_NODE_PRIVATE_MAGIC

#define XML_NODE_PRIVATE_MAGIC   0x54637281UL

Definition at line 176 of file xml.c.

◆ XPATH_MAX

#define XPATH_MAX   512

Definition at line 2149 of file xml.c.

Function Documentation

◆ add_node_copy()

xmlNode* add_node_copy ( xmlNode *  new_parent,
xmlNode *  xml_node 
)
Deprecated:
Do not use Pacemaker for general-purpose XML manipulation

Definition at line 2345 of file xml.c.

◆ add_node_nocopy()

int add_node_nocopy ( xmlNode *  parent,
const char *  name,
xmlNode *  child 
)
Deprecated:
This function will be removed in a future release

Definition at line 2361 of file xml.c.

◆ copy_in_properties()

void copy_in_properties ( xmlNode *  target,
const xmlNode *  src 
)
Deprecated:
Do not use

Definition at line 2696 of file xml.c.

◆ copy_xml()

xmlNode* copy_xml ( xmlNode *  src_node)
Deprecated:
Do not use Pacemaker for general-purpose XML manipulation

Definition at line 2461 of file xml.c.

◆ create_xml_node()

xmlNode* create_xml_node ( xmlNode *  parent,
const char *  name 
)
Deprecated:
Do not use Pacemaker for general-purpose XML manipulation

Definition at line 2476 of file xml.c.

◆ crm_destroy_xml()

void crm_destroy_xml ( gpointer  data)
Deprecated:
Do not use (will be removed in a future release)

Definition at line 2324 of file xml.c.

◆ crm_next_same_xml()

xmlNode* crm_next_same_xml ( const xmlNode *  sibling)
Deprecated:
Do not use Pacemaker for general-purpose XML manipulation

Definition at line 2555 of file xml.c.

◆ crm_xml_cleanup()

void crm_xml_cleanup ( void  )

Definition at line 2143 of file xml.c.

◆ crm_xml_escape()

char* crm_xml_escape ( const char *  text)
Deprecated:
Do not use

Definition at line 2402 of file xml.c.

◆ crm_xml_init()

void crm_xml_init ( void  )

Initialize the CRM XML subsystem.

This method sets global XML settings and loads pacemaker schemas into the cache.

Definition at line 2121 of file xml.c.

◆ crm_xml_sanitize_id()

void crm_xml_sanitize_id ( char *  id)

Sanitize a string so it is usable as an XML ID.

Parameters
[in,out]idString to sanitize

Definition at line 976 of file xml.c.

◆ crm_xml_set_id()

void crm_xml_set_id ( xmlNode *  xml,
const char *  format,
  ... 
)

Set the ID of an XML element using a format.

Parameters
[in,out]xmlXML element
[in]fmtprintf-style format
[in]...any arguments required by format

Definition at line 998 of file xml.c.

◆ expand_idref()

xmlNode* expand_idref ( xmlNode *  input,
xmlNode *  top 
)

Definition at line 2152 of file xml.c.

◆ expand_plus_plus()

void expand_plus_plus ( xmlNode *  target,
const char *  name,
const char *  value 
)
Deprecated:
Do not use

Definition at line 2719 of file xml.c.

◆ find_entity()

xmlNode* find_entity ( xmlNode *  parent,
const char *  node_name,
const char *  id 
)
Deprecated:
This function will be removed in a future release

Definition at line 2317 of file xml.c.

◆ find_xml_children()

int find_xml_children ( xmlNode **  children,
xmlNode *  root,
const char *  tag,
const char *  field,
const char *  value,
gboolean  search_matches 
)
Deprecated:
Do not use Pacemaker for general-purpose XML manipulation

Definition at line 2641 of file xml.c.

◆ find_xml_node()

xmlNode* find_xml_node ( const xmlNode *  root,
const char *  search_path,
gboolean  must_find 
)
Deprecated:
Do not use Pacemaker for general-purpose XML manipulation

Definition at line 2534 of file xml.c.

◆ first_named_child()

xmlNode* first_named_child ( const xmlNode *  parent,
const char *  name 
)
Deprecated:
Do not use Pacemaker for general-purpose XML manipulation

Definition at line 2528 of file xml.c.

◆ fix_plus_plus_recursive()

void fix_plus_plus_recursive ( xmlNode *  target)
Deprecated:
Do not use

Definition at line 2677 of file xml.c.

◆ free_xml()

void free_xml ( xmlNode *  child)

Definition at line 867 of file xml.c.

◆ getDocPtr()

xmlDoc* getDocPtr ( xmlNode *  node)
Deprecated:
This function will be removed in a future release

Definition at line 2330 of file xml.c.

◆ pcmk__mark_xml_node_dirty()

void pcmk__mark_xml_node_dirty ( xmlNode *  xml)

Definition at line 101 of file xml.c.

◆ pcmk__set_xml_doc_flag()

void pcmk__set_xml_doc_flag ( xmlNode *  xml,
enum xml_private_flags  flag 
)

Definition at line 89 of file xml.c.

◆ pcmk__strip_xml_text()

void pcmk__strip_xml_text ( xmlNode *  xml)

Definition at line 923 of file xml.c.

◆ pcmk__tracking_xml_changes()

bool pcmk__tracking_xml_changes ( xmlNode *  xml,
bool  lazy 
)

Definition at line 60 of file xml.c.

◆ pcmk__xc_match()

xmlNode* pcmk__xc_match ( const xmlNode *  root,
const xmlNode *  search_comment,
bool  exact 
)

Definition at line 1573 of file xml.c.

◆ pcmk__xc_update()

void pcmk__xc_update ( xmlNode *  parent,
xmlNode *  target,
xmlNode *  update 
)

Definition at line 1622 of file xml.c.

◆ pcmk__xe_add_last_written()

const char* pcmk__xe_add_last_written ( xmlNode *  xe)

Definition at line 959 of file xml.c.

◆ pcmk__xe_copy_attrs()

int pcmk__xe_copy_attrs ( xmlNode *  target,
const xmlNode *  src,
uint32_t  flags 
)

Definition at line 584 of file xml.c.

◆ pcmk__xe_create()

xmlNode* pcmk__xe_create ( xmlNode *  parent,
const char *  name 
)

Definition at line 720 of file xml.c.

◆ pcmk__xe_delete_match()

int pcmk__xe_delete_match ( xmlNode *  xml,
xmlNode *  search 
)

Definition at line 1839 of file xml.c.

◆ pcmk__xe_first_child()

xmlNode* pcmk__xe_first_child ( const xmlNode *  parent,
const char *  node_name,
const char *  attr_n,
const char *  attr_v 
)

Definition at line 440 of file xml.c.

◆ pcmk__xe_foreach_child()

int pcmk__xe_foreach_child ( xmlNode *  xml,
const char *  child_element_name,
int(*)(xmlNode *xml, void *userdata)  handler,
void *  userdata 
)

Definition at line 2288 of file xml.c.

◆ pcmk__xe_next_same()

xmlNode* pcmk__xe_next_same ( const xmlNode *  node)

Definition at line 2108 of file xml.c.

◆ pcmk__xe_remove_attr()

void pcmk__xe_remove_attr ( xmlNode *  element,
const char *  name 
)

Definition at line 652 of file xml.c.

◆ pcmk__xe_remove_attr_cb()

bool pcmk__xe_remove_attr_cb ( xmlNode *  xml,
void *  user_data 
)

Definition at line 674 of file xml.c.

◆ pcmk__xe_remove_matching_attrs()

void pcmk__xe_remove_matching_attrs ( xmlNode *  element,
bool(*)(xmlAttrPtr, void *)  match,
void *  user_data 
)

Definition at line 692 of file xml.c.

◆ pcmk__xe_replace_match()

int pcmk__xe_replace_match ( xmlNode *  xml,
xmlNode *  replace 
)

Definition at line 1952 of file xml.c.

◆ pcmk__xe_set_content()

void pcmk__xe_set_content ( xmlNode *  node,
const char *  format,
  ... 
)

Definition at line 758 of file xml.c.

◆ pcmk__xe_set_props()

void pcmk__xe_set_props ( xmlNodePtr  node,
  ... 
)

Definition at line 2279 of file xml.c.

◆ pcmk__xe_set_propv()

void pcmk__xe_set_propv ( xmlNodePtr  node,
va_list  pairs 
)

Definition at line 2261 of file xml.c.

◆ pcmk__xe_set_score()

int pcmk__xe_set_score ( xmlNode *  target,
const char *  name,
const char *  value 
)

Definition at line 525 of file xml.c.

◆ pcmk__xe_update_match()

int pcmk__xe_update_match ( xmlNode *  xml,
xmlNode *  update,
uint32_t  flags 
)

Definition at line 2046 of file xml.c.

◆ pcmk__xml_artefact_path()

char* pcmk__xml_artefact_path ( enum pcmk__xml_artefact_ns  ns,
const char *  filespec 
)

Definition at line 2241 of file xml.c.

◆ pcmk__xml_artefact_root()

char* pcmk__xml_artefact_root ( enum pcmk__xml_artefact_ns  ns)

Definition at line 2184 of file xml.c.

◆ pcmk__xml_copy()

xmlNode* pcmk__xml_copy ( xmlNode *  parent,
xmlNode *  src 
)

Definition at line 883 of file xml.c.

◆ pcmk__xml_escape()

gchar* pcmk__xml_escape ( const char *  text,
enum pcmk__xml_escape_type  type 
)

Definition at line 1110 of file xml.c.

◆ pcmk__xml_mark_created()

void pcmk__xml_mark_created ( xmlNode *  xml)

Definition at line 160 of file xml.c.

◆ pcmk__xml_match()

xmlNode* pcmk__xml_match ( const xmlNode *  haystack,
const xmlNode *  needle,
bool  exact 
)

Definition at line 385 of file xml.c.

◆ pcmk__xml_needs_escape()

bool pcmk__xml_needs_escape ( const char *  text,
enum pcmk__xml_escape_type  type 
)

Definition at line 1028 of file xml.c.

◆ pcmk__xml_position()

int pcmk__xml_position ( const xmlNode *  xml,
enum xml_private_flags  ignore_if_set 
)

Definition at line 342 of file xml.c.

◆ pcmk__xml_tree_foreach()

bool pcmk__xml_tree_foreach ( xmlNode *  xml,
bool(*)(xmlNode *, void *)  fn,
void *  user_data 
)

Definition at line 42 of file xml.c.

◆ pcmk__xml_update()

void pcmk__xml_update ( xmlNode *  parent,
xmlNode *  target,
xmlNode *  update,
uint32_t  flags,
bool  as_diff 
)

Definition at line 1675 of file xml.c.

◆ pcmk_create_html_node()

xmlNode* pcmk_create_html_node ( xmlNode *  parent,
const char *  element_name,
const char *  id,
const char *  class_name,
const char *  text 
)
Deprecated:
Do not use Pacemaker for general-purpose XML manipulation

Definition at line 2518 of file xml.c.

◆ pcmk_create_xml_text_node()

xmlNode* pcmk_create_xml_text_node ( xmlNode *  parent,
const char *  name,
const char *  content 
)
Deprecated:
Do not use Pacemaker for general-purpose XML manipulation

Definition at line 2508 of file xml.c.

◆ pcmk_free_xml_subtree()

void pcmk_free_xml_subtree ( xmlNode *  xml)

Free an XML element and all of its children, removing it from its parent

Parameters
[in,out]xmlXML element to free

Definition at line 795 of file xml.c.

◆ replace_xml_child()

gboolean replace_xml_child ( xmlNode *  parent,
xmlNode *  child,
xmlNode *  update,
gboolean  delete_only 
)
Deprecated:
Do not use Pacemaker for general-purpose XML manipulation

Definition at line 2567 of file xml.c.

◆ sorted_xml()

xmlNode* sorted_xml ( xmlNode *  input,
xmlNode *  parent,
gboolean  recursive 
)

Definition at line 2072 of file xml.c.

◆ update_xml_child()

gboolean update_xml_child ( xmlNode *  child,
xmlNode *  to_update 
)
Deprecated:
Do not use Pacemaker for general-purpose XML manipulation

Definition at line 2634 of file xml.c.

◆ xml_accept_changes()

void xml_accept_changes ( xmlNode *  xml)

Definition at line 402 of file xml.c.

◆ xml_calculate_changes()

void xml_calculate_changes ( xmlNode *  old_xml,
xmlNode *  new_xml 
)

Definition at line 1549 of file xml.c.

◆ xml_calculate_significant_changes()

void xml_calculate_significant_changes ( xmlNode *  old_xml,
xmlNode *  new_xml 
)

Definition at line 1541 of file xml.c.

◆ xml_document_dirty()

bool xml_document_dirty ( xmlNode *  xml)

Definition at line 325 of file xml.c.

◆ xml_has_children()

gboolean xml_has_children ( const xmlNode *  root)
Deprecated:
Check children member directly

Definition at line 2369 of file xml.c.

◆ xml_remove_prop()

void xml_remove_prop ( xmlNode *  obj,
const char *  name 
)
Deprecated:
Do not use Pacemaker for general-purpose XML manipulation

Definition at line 2561 of file xml.c.

◆ xml_track_changes()

void xml_track_changes ( xmlNode *  xml,
const char *  user,
xmlNode *  acl_source,
bool  enforce_acls 
)

Definition at line 303 of file xml.c.

◆ xml_tracking_changes()

bool xml_tracking_changes ( xmlNode *  xml)

Definition at line 318 of file xml.c.