Hello, I have an XML file, for example: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <flat-profile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <SomeElement>ccccc</SomeElement> </flat-profile> and I can easily edit it with this simple code: <?php $dom = new DOMDocument; $dom->load('XML/sample.xml'); $SomeElement = $dom->getElementsByTagname('SomeElement')->item(0)->firstChild->nodeValue; echo '<br> Current value is: ' . $SomeElement . '<br>'; $dom->getElementsByTagname('SomeElement')->item(0)->firstChild->nodeValue = 'aaaaa'; $SomeElementValue = $dom->getElementsByTagname('SomeElement')->item(0)->firstChild->nodeValue; echo '<br> New value is: ' . $SomeElementValue . '<br>'; $dom->save('XML/sample.xml'); ?> This works fine, but when I, in XML file, instead of: <SomeElement>ccccc</SomeElement> have: <SomeElement/> or <SomeElement></SomeElement> It want work, it does not want to change SomeElement to a value 'aaaaa'. Is there some mistake with this code: $dom->getElementsByTagname('SomeElement')->item(0)->firstChild->nodeValue; or ????? Please help... Thanks