I'm trying to update XML document. I start with a string that contains XML.
I'm loading that string to SimpleXMLElement object:
$xmlDoc = simplexml_load_string($my_xml_string);
I find a node that I would like to update like so:
$node= $xmlDoc->xpath("//nodename[@node_attribute='{$search_attribute_value}']");
Now I would like to update the node_attribute attribute. I try to do $node['node_attribute']=$new_attribute_value however $node is it's own object and this doesn't update the $xmlDoc object.
How do I find and update attribute value in the $xmlDoc?