note 86224 added to class.domelement

[email protected] ((AT))
Newsgroups php.notes
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.