| 163 | } |
| 164 | |
| 165 | xmlNode * |
| 166 | find_xml_node(xmlNode *root, const char * search_path, gboolean must_find) |
| 167 | { |
| 168 | xmlNode *a_child = NULL; |
| 169 | const char *name = "NULL"; |
| 170 | if(root != NULL) { |
| 171 | name = crm_element_name(root); |
| 172 | } |
| 173 | |
| 174 | if(search_path == NULL) { |
| 175 | crm_warn("Will never find <NULL>"); |
| 176 | return NULL; |
| 177 | } |
| 178 | |
| 179 | for(a_child = __xml_first_child(root); a_child != NULL; a_child = __xml_next(a_child)) { |
| 180 | if(strcmp((const char *)a_child->name, search_path) == 0) { |
| 181 | /* crm_trace("returning node (%s).", crm_element_name(a_child)); */ |
| 182 | return a_child; |
| 183 | } |
| 184 | } |
| 185 | |
| 186 | if(must_find) { |
| 187 | crm_warn("Could not find %s in %s.", search_path, name); |
| 188 | } else if(root != NULL) { |
| 189 | crm_trace("Could not find %s in %s.", search_path, name); |
| 190 | } else { |
| 191 | crm_trace("Could not find %s in <NULL>.", search_path); |
| 192 | } |
| 193 | |
| 194 | |
| 195 | return NULL; |
| 196 | } |
| 197 | |
| 198 | xmlNode* |
| 199 | find_entity(xmlNode *parent, const char *node_name, const char *id) |
no test coverage detected