note 37739 added to function.domdocument-create-element
| From: | dk at rn2 dot php dot net | Date: | Tue, 25 Nov 2003 04:58:36 +0000 |
| Subject: | note 37739 added to function.domdocument-create-element | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-60943@lists.php.net to get a copy of this message | ||
The first example on this page is also a bit verbose. Since the DomElement class inherits/extends
the DomNode class, one does not, in fact, have to get another reference to the first node. The
create_element method has already given you that reference. (Also, the last line passes a string to
the append_child method, instead of a DomNode object) Simplified:
<?
$new_element = $dom->create_element("new_element");
$new_element->append_child($another_element);
$oldTag->append_child($new_element);
?>
----
Manual Page -- http://www.php.net/manual/en/function.domdocument-create-element.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+37739
Delete -- http://master.php.net/manage/user-notes.php?action=delete+37739&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+37739&report=yes
Search -- http://master.php.net/manage/user-notes.php