SimpleXMLElement problem

This is a discussion on SimpleXMLElement problem within the PHP Language forums, part of the PHP Programming Forums category; I am trying to run examples in the php.net but I am getting the error Fatal error: Call to ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 07-28-2006
johnmark@fastermail.com
 
Posts: n/a
Default SimpleXMLElement problem

I am trying to run examples in the php.net but I am getting the error

Fatal error: Call to undefined method SimpleXMLElement::addChild()

The example is as follows

$xml = new SimpleXMLElement($xmlstr);

$character = $xml->movie[0]->characters->addChild('character');
$character->addChild('name', 'Mr. Parser');
$character->addChild('actor', 'John Doe');

$rating = $xml->movie[0]->addChild('rating', 'PG');
$rating->addAttribute('type', 'mpaa');

echo $xml->asXML();



Does anyone konw whats going on here?

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 02:29 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0