note 121040 added to class.domdocumentfragment
| From: | peter at softcoded dot com | Date: | Wed, 03 May 2017 15:31:57 +0000 |
| Subject: | note 121040 added to class.domdocumentfragment | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-209044@lists.php.net to get a copy of this message | ||
DOMDocumentFragment makes it easy to add (or replace)
nodes. Individually creating nodes using DOM methods can
be tedious. Instead, do something like this:
/**
* Create fragment of colgroup
* @param DOMDocument $doc The DOMDocument
* @return DOMDocumentFragment
*/
function makeFragment($d){
$chunk = <<<HTML
<colgroup>
<col class="c1"/>
<col class="c2"/>
<col class="c3"/>
<col class="c4"/>
</colgroup>
HTML;
$fragment = $d->createDocumentFragment();
$fragment->appendXML($chunk);
return $fragment;
}
----
Server IP: 72.52.91.14
Probable Submitter: 23.249.203.110
----
Manual Page -- http://php.net/manual/en/class.domdocumentfragment.php
Edit -- https://master.php.net/note/edit/121040
Del: integrated -- https://master.php.net/note/delete/121040/integrated
Del: useless -- https://master.php.net/note/delete/121040/useless
Del: bad code -- https://master.php.net/note/delete/121040/bad+code
Del: spam -- https://master.php.net/note/delete/121040/spam
Del: non-english -- https://master.php.net/note/delete/121040/non-english
Del: in docs -- https://master.php.net/note/delete/121040/in+docs
Del: other reasons-- https://master.php.net/note/delete/121040
Reject -- https://master.php.net/note/reject/121040
Search -- https://master.php.net/manage/user-notes.php