Uncaught exception 'DOMException' with message 'Not Found Error' on line:
$xml_Document->replaceChild($newTemplate_name,$oldTemplate_name);
xml file - xml_mail_format2.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<Email>
<Template>
Temaplate1
</Template>
<Temp>
Template2
</Temp>
</Email>
php file - xml_experiments.php
<?php
include('header.php');
$xml_Document= new DOMDocument("");
$xml_Document->formatOutput = true;
$xml_Document->preserveWhiteSpace = false;
$xml_Document->load('xml_mail_format2.xml');
$oldTemplate_name = $xml_Document->getElementsByTagName('Template')->item(0);
$newTemplate_name = $xml_Document->createElement('Template','asdfsdsdf');
echo $newTemplate_name->nodeValue;
$xml_Document->replaceChild($newTemplate_name,$oldTemplate_name);