Re: Why create_element function always return false?
| From: | Tijnema ! | Date: | Sat, 05 May 2007 22:12:30 +0000 |
| Subject: | Re: Why create_element function always return false? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-254476@lists.php.net to get a copy of this message | ||
On 5/5/07, Victor <victor_km@mail2000.com.tw> 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 strange....I found that create_element always return false....nomatter what I do....what 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