xmlUnsetProp(iter, XML_CIB_ATTR_ACTION); xmlAddChild(res, iter);
xmlNodePtr node_copy = xmlCopyNode(iter, 1);  xmlUnsetProp(node_copy, XML_CIB_ATTR_ACTION); xmlAddChild(res, node_copy);
updateResource(xmlNodePtr cib, cibResource *anXmlNode){    CRM_DEBUG2("Updating " XML_CIB_TAG_RESOURCE " (%s)...", ID(anXmlNode));        xmlNodePtr res = findResource(cib, ID(anXmlNode));    if(res == NULL)    {	CRM_DEBUG2("Update: " XML_CIB_TAG_RESOURCE " (%s) did not exist, adding.", ID(anXmlNode));	addResource(cib, anXmlNode);    }    else    {	//need to call?? xmlFreeNodeList();#ifdef REPLACE	xmlReplaceNode(res, anXmlNode);	anXmlNode->children = res->children;	res->children = NULL; // make sure res doesnt modify them#else	copyInProperties(anXmlNode, res);		CRM_DEBUG2("Update: Copying in children for " XML_CIB_TAG_RESOURCE " (%s).", ID(anXmlNode));	xmlNodePtr iter = anXmlNode->children;	while(iter != NULL)	{	    if(strcmp(XML_CIB_ATTR_NODEREF, iter->name) == 0)	    {		const char *action = xmlGetProp(iter, XML_CIB_ATTR_ACTION);		const char *id = ID(iter);		xmlNodePtr dest = findEntity(res, XML_CIB_ATTR_NODEREF, id, FALSE);				if(dest != NULL) xmlUnlinkNode(dest);		if(strcmp("add", action) == 0)		{		    xmlUnsetProp(iter, XML_CIB_ATTR_ACTION); // remove the action property		    xmlAddChild(res, iter);		}	    }	}#endif    }    FNRET(0);    }