Jump to content

Fatal error: Class 'SimpleXMLElemant' not found


attaboy

Recommended Posts

I'm trying to learn how to modify xml using simple xml.

This is my code:

 

<?php

// modifying content

$xml = "<root><node1>content</node1></root>";

$sxe = new SimpleXMLElemant($xml);

$dom = dom_import_simplexml($sxe);

$dom->appendChild(new DOMElement("node2", "content2"));

print $sxe->asXML();

?>

 

This is the error message:

Fatal error: Class 'SimpleXMLElemant' not found in C:\xampp\htdocs\Erik_form\modify.php on line 4

 

Looking at phpinfo() doesn't show me anything useful. I wonder is SimpleXMLElemant() depricated or something?

post-94869-0-33423000-1360818052_thumb.png

It looks like you're just learning this stuff, so it might be useful to know how to add elements directly with SimpleXML, rather than using the DOM functions.

 

Two available options are:

  • $sxe->addChild("node2", "content2");


  • $sxe->node2 = "content2";


Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.