`please check my code I'm newbie for php5 and xml
"friends.xml"
<?xml version="1.0" encoding="UTF-8"?>
<friends>
<friend>
<name>Eric</name>
<email>eric@hotmail.com</email>
</friend>
<friend>
<name>John</name>
<email>john@hotmail.com</email>
</friend>
<friend>
<name>James</name>
<email>james@hotmail.com</email>
</friend>
</friends>
friends.php
<?php
#- The path to the XML files
$dom = new DomDocument();
$dom->load("friends.xml");
$xp = new domxpath($dom);
$result = $xp->query("//friends/friend[name =
'James']/email");
#- Get the node
$email = $result->nodeset;
//#- Create the new email and replace the old one
$newEmail = $dom->createtextnode('jamesnew@hotmail.com');
$email[0]->replacechild( $newEmail,
$email[0]->first_child());
#- Print it as an XML file
print $dom->save("friends.xml");
?>
please show me some sample of replacechild replacenode
!!!!!
best regard
thee
replacechild help`!!!! `Please
Moderator: General Moderators