Re: [PHP] Why create_element function always return false?
On Fri, May 4, 2007 9:44 pm, Victor wrote: ?php $doc = domxml_new_doc(1.0); var_dump($doc); $node = $doc-create_element(para); var_dump($node); $newnode = $doc-append_child($node); var_dump($newnode); $newnode-set_attribute(align, left); ? I just run the example that is from php manual. But there is some error Presumable http://php.net/domxml_new_doc documents what happens when there is an error, and how to deal with it. The PHP samples are just that: samples You have to add about 5 X as much code to have a robuts error-handling won't make your life miserable application... -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why create_element function always return false?
On 5/5/07, Victor [EMAIL PROTECTED] wrote: ?php $doc = domxml_new_doc(1.0); $node = $doc-create_element(para); $newnode = $doc-append_child($node); $newnode-set_attribute(align, left); ? I just run the example that is from php manual. But there is some error -- Warning: domnode::append_child() expects parameter 1 to be object, null given in C:\AppServ\www\tutorial\test.php on line 4 Fatal error: Call to a member function set_attribute() on a non-object in C:\AppServ\www\tutorial\test.php on line 5 -- It is very strangeI found that create_element always return falsenomatter what I dowhat example I tried... Not only create_element return false but also create_coment do so... Why??? I run php 5.2.2 with AppServ . The version of docmxl is 20626 (I just call domxml_version() ). OS is Windows XP. Would someone help me ,please? Thanks a lot. Victor. AFAIK, append_child and create_element are decprecated, they are only used in PHP4. You should use appendchild and createelement instead. try example 498 located here: http://www.php.net/manual/en/function.dom-domdocument-createelement.php Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Why create_element function always return false?
?php $doc = domxml_new_doc(1.0); $node = $doc-create_element(para); $newnode = $doc-append_child($node); $newnode-set_attribute(align, left); ? I just run the example that is from php manual. But there is some error -- Warning: domnode::append_child() expects parameter 1 to be object, null given in C:\AppServ\www\tutorial\test.php on line 4 Fatal error: Call to a member function set_attribute() on a non-object in C:\AppServ\www\tutorial\test.php on line 5 -- It is very strangeI found that create_element always return falsenomatter what I dowhat example I tried... Not only create_element return false but also create_coment do so... Why??? I run php 5.2.2 with AppServ . The version of docmxl is 20626 (I just call domxml_version() ). OS is Windows XP. Would someone help me ,please? Thanks a lot. Victor. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php