| 1718 | |
| 1719 | |
| 1720 | int |
| 1721 | find_xml_children(xmlNode **children, xmlNode *root, |
| 1722 | const char *tag, const char *field, const char *value, |
| 1723 | gboolean search_matches) |
| 1724 | { |
| 1725 | int match_found = 0; |
| 1726 | |
| 1727 | CRM_CHECK(root != NULL, return FALSE); |
| 1728 | CRM_CHECK(children != NULL, return FALSE); |
| 1729 | |
| 1730 | if(tag != NULL && safe_str_neq(tag, crm_element_name(root))) { |
| 1731 | |
| 1732 | } else if(value != NULL |
| 1733 | && safe_str_neq(value, crm_element_value(root, field))) { |
| 1734 | |
| 1735 | } else { |
| 1736 | if(*children == NULL) { |
| 1737 | *children = create_xml_node(NULL, __FUNCTION__); |
| 1738 | } |
| 1739 | add_node_copy(*children, root); |
| 1740 | match_found = 1; |
| 1741 | } |
| 1742 | |
| 1743 | if(search_matches || match_found == 0) { |
| 1744 | xmlNode *child = NULL; |
| 1745 | for(child = __xml_first_child(root); child != NULL; child = __xml_next(child)) { |
| 1746 | match_found += find_xml_children( |
| 1747 | children, child, tag, field, value, |
| 1748 | search_matches); |
| 1749 | } |
| 1750 | } |
| 1751 | |
| 1752 | return match_found; |
| 1753 | } |
| 1754 | |
| 1755 | gboolean |
| 1756 | replace_xml_child(xmlNode *parent, xmlNode *child, xmlNode *update, gboolean delete_only) |
nothing calls this directly
no test coverage detected