Hey guys
Im trying to build a plugin for a php script. Its going fine and
dandy.
Data is store in an XML file. Which has the following structure:
<raiders>
<raider>
<name>Anarchie</name>
<ready>?</ready>
</raider>
</raiders>
What i need to do is be able to find a "raider" and change the ready
node to something else.
For this i wrote this code snippet:
-
$doc = new DomDocument();
$doc->load($DataDir."/raid.bot/raid.xml");
$raiders = $doc->getElementsByTagName("raider");
foreach ($raiders as $raider)
{
$names = $raider->getElementsByTagName("name");
$name = $names->item(0)->nodeValue;
if($name = $sender)
{
$statuses = $raider->getElementsByTagName("ready");
$ready = $statuses->item(0)->setContent("yes");
}
}
$doc->save($DataDir."/raid.bot/raid.xml");
send_reply("Updated status to ready");
-
However it complains about the "set content" method:
PHP Fatal error: Call to undefined method DOMElement::setContent() in
F:\Games\
guildBot\plugins\tell\raid.bot\index.php on line 89
I have tried set_content() aswell.
Any ideas what im doing wrong here? Is set_content really the only way
to update a node in DOM xml?
Thoughts, ideas and suggestions are welcome.
- Mike