note 86224 added to class.domelement

From: Date: Wed, 08 Oct 2008 16:11:51 +0000
Subject: note 86224 added to class.domelement
Groups: php.notes 
Request: Send a blank email to php-notes+get-145169@lists.php.net to get a copy of this message
Caveat! It took me almost an hour to figure this out, so I hope it saves at least one of you some time. If you want to debug your DOM tree and try var_dump() or similar you will be fooled into thinking the DOMElement that you are looking at is empty, because var_dump() says: object(DOMElement)#1 (0) { } After much debugging I found out that all DOM objects are invisible to var_dump() and print_r(), my guess is because they are C objects and not PHP objects. So I tried saveXML(), which works fine on DOMDocument, but is not implemented on DOMElement. The solution is simple (if you know it): $xml = $domElement->ownerDocument->saveXML($domElement); This will give you an XML representation of $domElement. ---- Server IP: 217.160.72.57 Probable Submitter: 134.95.55.147 ---- Manual Page -- http://www.php.net/manual/en/class.domelement.php Edit -- https://master.php.net/note/edit/86224 Del: integrated -- https://master.php.net/note/delete/86224/integrated Del: useless -- https://master.php.net/note/delete/86224/useless Del: bad code -- https://master.php.net/note/delete/86224/bad+code Del: spam -- https://master.php.net/note/delete/86224/spam Del: non-english -- https://master.php.net/note/delete/86224/non-english Del: in docs -- https://master.php.net/note/delete/86224/in+docs Del: other reasons-- https://master.php.net/note/delete/86224 Reject -- https://master.php.net/note/reject/86224 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#145169) next »