title: Replace text in xml loaded with simplexml_load_file()?
body: <p>I have this xml file: </p>
  
  <pre><code>&lt;flats&gt;
      &lt;flat&gt;
  
          &lt;images1&gt;http://www.example.com/image1.jpg&lt;/images1&gt;
          &lt;images2&gt;http://www.example.com/image1.jpg&lt;/images2&gt;
  
      &lt;/flat&gt;
  &lt;/flats&gt;
  </code></pre>
  
  <p>Which I need to load using php and then replace some node names to get this (just change <strong>image1</strong> and <strong>image2</strong> to <strong>images</strong>:</p>
  
  <pre><code>&lt;flats&gt;
      &lt;flat&gt;
  
          &lt;images&gt;http://www.example.com/image1.jpg&lt;/images&gt;
          &lt;images&gt;http://www.example.com/image1.jpg&lt;/images&gt;
  
      &lt;/flat&gt;
  &lt;/flats&gt;
  </code></pre>
  
  <p>I managed to load and save the file, but I don't know how to replace the node names.</p>
  
  <pre><code>$xml_external_path = 'http://external-site.com/original.xml';
  $xml = simplexml_load_file($xml_external_path);
  
  $xml-&gt;asXml('updated.xml');
  </code></pre>
  
  <p><strong>UPDATE:</strong>
  PHP   </p>
  
  <pre><code>    $xml_external_path = 'http://external-site.com/original.xml';
      $xml = simplexml_load_file($xml_external_path);
      print_r($xml);
      $newXml = str_replace( 'images1', 'image',$xml ) ;
      print_r($newXml);
  </code></pre>