|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-12-27 12:40 UTC] rrichards@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Wed Feb 04 21:00:01 2026 UTC |
Description: ------------ You're missing a very handful feature and it's pretty annoying to make a workaround which cannot perform exactly what I need until PHP is fixed. Reproduce code: --------------- This is my crappy workaround for the missing Dom->importString(), however the support in DOM should be made. /** * Import a string like something<br /><strong>strong</strong> into the DomDocument * * @param string string * @param DomElement parent * @return DomElement reference to imported node */ public function importString($string, $parent) { if ($parent === NULL) { throw new Exception('Parent cannot be NULL.'); } $tmp = new DomDocument('1.0', 'utf-8'); // The div is unwanted here, but loadXml doesn't work without it $tmp->loadXml('<div>' . $string . '</div>'); return $this->domImportNode($tmp->firstChild); } Actual result: -------------- PHP DOM doesn't provide any similar functionaly, although it's needed.