Take the 2-minute tour ×  This is my xml file. I want to insert-
update data using the dom method in between the tags. I am a
beginner in php and Xml technologies. I successfully created and
read from this file but not been able to enter data in it using
php.  The code for creating is as follows:-    $ele =
$doc->createElement( 'root' );   $ele->nodeValue = $uvar;
$doc->appendChild( $ele );   $test = $doc->save("$id.xml");  The
code for reading is as follows:-    $xdoc = new DOMDocument( );
$candidate = $xdoc->getElementsByTagName('root')->item(0);
$newElement = $xdoc ->createElement('root');   $txtNode = $xdoc
->createTextNode ($root);   $newElement ->
appendChild($txtNode);   $candidate -> appendChild($newElement);
$msg = $candidate->nodeValue;  Can someone help out with
inserting and updating. Thank You!  share|improve this question
could you make your question more clear. Where are you getting
your text to update your xml, or put your final XML structure.
–  tsegay Dec 28 '10 at 23:58 add comment