note 119357 added to function.dom-import-simplexml
| From: | biniou at yopmail dot com | Date: | Fri, 20 May 2016 09:59:01 +0000 |
| Subject: | note 119357 added to function.dom-import-simplexml | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-205519@lists.php.net to get a copy of this message | ||
Very useful to add a CDATA node with SimpleXMLElement (use it like addChild) :
<?php
class My_SimpleXMLElement extends SimpleXMLElement {
public function addChildWithCData($name, $value = NULL) {
$new_child = $this->addChild($name);
$node = dom_import_simplexml($new_child);
$no = $node->ownerDocument;
$node->appendChild($no->createCDATASection($value));
return $new_child;
}
}
----
Server IP: 72.52.91.14
Probable Submitter: 81.56.220.5
----
Manual Page -- http://php.net/manual/en/function.dom-import-simplexml.php
Edit -- https://master.php.net/note/edit/119357
Del: integrated -- https://master.php.net/note/delete/119357/integrated
Del: useless -- https://master.php.net/note/delete/119357/useless
Del: bad code -- https://master.php.net/note/delete/119357/bad+code
Del: spam -- https://master.php.net/note/delete/119357/spam
Del: non-english -- https://master.php.net/note/delete/119357/non-english
Del: in docs -- https://master.php.net/note/delete/119357/in+docs
Del: other reasons-- https://master.php.net/note/delete/119357
Reject -- https://master.php.net/note/reject/119357
Search -- https://master.php.net/manage/user-notes.php