ID:               44762
 Comment by:       patrick at patricksmith dot org
 Reported By:      xwisdom at yahoo dot com
 Status:           Open
 Bug Type:         Feature/Change Request
 Operating System: Windows XP
 PHP Version:      5.2.5
 New Comment:

In the meantime, here's a utility function that you may find helpful:

$innerHTML = '';
$elem = $doc->getElementById($elem_id);

// loop through all childNodes, getting html            
$children = $elem->childNodes;
foreach ($children as $child) {
    $tmp_doc = new DOMDocument();
    $tmp_doc->appendChild($tmp_doc->importNode($child,true));           
    $innerHTML .= $tmp_doc->saveHTML();
}


Previous Comments:
------------------------------------------------------------------------

[2008-04-17 14:40:05] xwisdom at yahoo dot com

Description:
------------
I would like to request that a innerHTML property (or method) be added
to DOMElement class. This would make it so much easier to retrieve and
set the html or xml content of a node.

Right now we have to use fragments with several lines of to get the job
done. It would be so much better to be able to do it in one line of code
:)







------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=44762&edit=1

Reply via email to