#48504 [Opn]: document_element contains nothing

From: Date: Tue, 09 Jun 2009 10:53:32 +0000
Subject: #48504 [Opn]: document_element contains nothing
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-138136@lists.php.net to get a copy of this message
ID: 48504 User updated by: ikrabbe dot ask at web dot de Reported By: ikrabbe dot ask at web dot de Status: Open Bug Type: DOM XML related Operating System: Linux PHP Version: 5.2.9 New Comment: Actually: if ( !$xmldocu->document_element ) echo "NULL Document"; reveals a NULL root node ! Thats actually a bug. Please either correct this behaviour or describe whats meant by "document_element" in the documentation. Previous Comments: ------------------------------------------------------------------------ [2009-06-09 10:48:36] ikrabbe dot ask at web dot de Description: ------------ on $xml="<a><b>abc</b><c/></a>"; $xmldoc = new DOMDocument(); $xmldoc->loadXML($xml); I get for echo "item 0=".$xmldoc->childNodes->item(0)->nodeName."\n"; echo "root =".$xmldoc->document_element->nodeName."\n"; the output: item 0=a root= I assumed that document_element should be the same as childNodes->item(0), so I assume that is a bug. Reproduce code: --------------- see above Expected result: ---------------- see above Actual result: -------------- see above ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=48504&edit=1

« previous php.bugs (#138136) next »