title: Change the value of a text node using SimpleXML
body: <p>I am trying to write a code where it will find a specific element in my XML file and then change the value of the text node. The XML file has different namespaces. Till now, I have managed to register the namespaces and also echo the text node of the element, which I want to change. </p>
  
  <pre><code>   &lt;?php
  
     $xml = simplexml_load_file('getobs.xml');
  
     $xml-&gt;registerXPathNamespace('g','http://www.opengis.net/gml');
  
     $result = $xml-&gt;xpath('//g:beginPosition');
  
  
     foreach ($result as $title) {
     echo $title . "\n";
     }
     ?&gt;
  </code></pre>
  
  <p>My question is: How can I change the value of this element using SimpleXML? I tried to use the nodeValue command but I am not able to make it work.</p>
  
  <p>This is a part of the XML:</p>
  
  <pre><code>        &lt;sos:GetObservation xmlns:sos="http://www.opengis.net/sos/1.0"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" service="SOS" version="1.0.0"  srsName="urn:ogc:def:crs:EPSG:4326"&gt;
            &lt;sos:offering&gt;urn:gfz:cawa:def:offering:meteorology&lt;/sos:offering&gt;
              &lt;sos:eventTime&gt;
                &lt;ogc:TM_During xmlns:ogc="http://www.opengis.net/ogc" xsi:type="ogc:BinaryTemporalOpType"&gt;
                &lt;ogc:PropertyName&gt;urn:ogc:data:time:iso8601&lt;/ogc:PropertyName&gt;
                  &lt;gml:TimePeriod xmlns:gml="http://www.opengis.net/gml"&gt;
                    &lt;gml:beginPosition&gt;2011-02-10T01:10:00.000&lt;/gml:beginPosition&gt;
  </code></pre>
  
  <p>Thanks
  Dimitris</p>