child_result = dump_data_element( depth+1, buffer, data->values[lpc], formatted);  if(child_result < 0) { return -1; } }  if(formatted) { printed = print_spaces(*buffer, 3*depth); update_buffer_head(buffer, printed); } printed = sprintf(*buffer, "</%s>%s", name, formatted?"\n":""); update_buffer_head(buffer, printed); crm_debug("Dumped %s...", name);  return has_children; }
dump_data_element(	int depth, char **buffer, const crm_data_t *data, gboolean formatted) {	int lpc = 0;	int printed = 0;	int child_result = 0;	int has_children = 0;	const char *name = crm_element_name(data);	crm_debug("Dumping %s...", name);	if(buffer == NULL || *buffer == NULL) {		crm_err("No buffer supplied to dump XML into");		return -1;	} else if(data == NULL) {		crm_warn("No data to dump as XML");		(*buffer)[0] = EOS;		return 0;	} else if(name == NULL && depth == 0) {		xml_child_iter(			data, a_child, NULL,			child_result = dump_data_element(				depth, buffer, a_child, formatted);			if(child_result < 0) {				return child_result;			}			);		return 0;	} else if(name == NULL) {		crm_err("Cannot dump NULL element at depth %d", depth);		return -1;	}		if(formatted) {		printed = print_spaces(*buffer, 3*depth);		update_buffer_head(buffer, printed);	}		printed = sprintf(*buffer, "<%s", name);	update_buffer_head(buffer, printed);	for (lpc = 0; lpc < data->nfields; lpc++) {		if(data->types[lpc] == FT_STRING) {			/* attribute */			if(safe_str_eq(XML_ATTR_TAGNAME, data->names[lpc])) {				continue;			} else if(safe_str_eq(XML_ATTR_PARENT, data->names[lpc])) {				continue;			}						crm_debug("Dumping <%s %s=\"%s\"...",				  name, data->names[lpc], (const char*)data->values[lpc]);			printed = sprintf(*buffer, " %s=\"%s\"",					  data->names[lpc], (char*)data->values[lpc]);			update_buffer_head(buffer, printed);					} else if(data->types[lpc] == FT_STRUCT) {			/* children */			has_children++;					} else if(data->types[lpc] == FT_LIST) {			/* needed? */		} else {			CRM_ASSERT(FALSE);		}	}	printed = sprintf(*buffer, "%s>%s", has_children==0?"/":"", formatted?"\n":"");	update_buffer_head(buffer, printed);	if(has_children == 0) {		return 0;	}	for (lpc = 0; has_children && lpc < data->nfields; lpc++) {		if(data->types[lpc] != FT_STRUCT) {			continue;		}				child_result = dump_data_element(			depth+1, buffer, data->values[lpc], formatted);		if(child_result < 0) { return -1; }	}	if(formatted) {		printed = print_spaces(*buffer, 3*depth);		update_buffer_head(buffer, printed);	}	printed = sprintf(*buffer, "</%s>%s", name, formatted?"\n":"");	update_buffer_head(buffer, printed);	crm_debug("Dumped %s...", name);	return has_children;}