I'm working on creating XML docs from values in a database. Initially, the program exports this XML:
<customDataElementlanguage>English</customDataElementlanguage>
I've created this PHP to change the XML tree:
if ($Element->nodeValue = "EN") { $Element->nodeValue = "English"; }
$doc2 = $Element->ownerDocument;
$titleElement = $doc2->createElement('title','language');
$valueElement = $doc2->createElement('value',$Element->nodeValue);
$Element->appendChild($titleElement);
$Element->appendChild($valueElement);
//$Element->nodeValue="";
into this:
<customDataElementlanguage>
English
<title>language</title>
<value>English</value>
</customDataElementlanguage>
My problem is that I can't seem to find a way to remove the "English" text from the node without wiping out the child nodes title
and value
inside. That's what happens when I end my PHP code with $Element->nodeValue="";
I'd also like to change the name of the customDataElemementlanguage node to customDataElement but I can work on that later I suppose :)
Thanks for your help!