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.