using domxml ??
Posted by: chaluwa (217.20.251.---)
Date: October 31, 2007 11:26AM

Hello people, just joined this forum, and need help seriously on an application I am working on currently. The problem is that the ISP account that was purchased for the site runs on PHP4, but I developed the site with PHP5 using its standard Dom API to generate xml strings, convert to json on the client and do further processing. Now I am having problems downgrading to PHP4's domxml.

I wrote similar code (for the xml processing) in PHP4 using domxml after reading some docs and tutorials, please how can I test this code on my WAMP5 development environment??

I tried to enable domxml in my WAMP5 development environment by doing this :
click on WAMP5 tray icon -> PHP settings -> PHP extensions ->
php_domxml
and observed the service restarting, and then ran the following code :
<?php
$doc = domxml_new_doc("1.0"winking smiley;
$node = $doc->create_element("para"winking smiley;
$newnode = $doc->append_child($node);
$newnode->set_attribute("align", "left"winking smiley;

$xmlStr = $doc->dump_mem(true);
print $xmlStr;
?>
and got the following error message :

Warning: domnode::append_child() expects parameter 1 to be object, null given in C:\wamp\www\testdomxml.php on line 4

Fatal error: Call to a member function set_attribute() on a non-object in C:\wamp\www\testdomxml.php on line 5

The code seems correct (by my understanding), and a rewrite of the code using PHP5's DOM works fine on a normal WAMP5 setting.
With the above error message, the problems seems to me that the $node object is not even initialized, thus I think it has to do with my WAMP5 domxml settings.
Please how do I setup my WAMP5 environment so I can develop and run tests with PHP4's domxml and upload once to the ISP server.



Thanks,
Charles Odili
University of Benin,
Nigeria

Sorry, only registered users may post in this forum.