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>Anarchi e</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->getElementsByT agName("raider" );
foreach ($raiders as $raider)
{
$names = $raider->getElementsByT agName("name");
$name = $names->item(0)->nodeValue;
if($name = $sender)
{
$statuses = $raider->getElementsByT agName("ready") ;
$ready = $statuses->item(0)->setContent("ye s");
}
}
$doc->save($DataDir. "/raid.bot/raid.xml");
send_reply("Upd ated status to ready");
-
However it complains about the "set content" method:
PHP Fatal error: Call to undefined method DOMElement::set Content() in
F:\Games\
guildBot\plugin s\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