ID: 47612 Comment by: murlock42 at gmail dot com Reported By: murlock42 at gmail dot com Status: Open Bug Type: DOM XML related Operating System: Linux Debian Lenny PHP Version: 5.3CVS-2009-03-10 (snap) New Comment:
The url for the XML files : http://murlock.org/file_with_dtd.xml http://murlock.org/file_without_dtd.xml Thanks, Previous Comments: ------------------------------------------------------------------------ [2009-03-10 08:36:14] murlock42 at gmail dot com Description: ------------ When I use a XML file with DTD, the root node doesn't have any children (but xpath query works) and if I removed the DTD, the DOM seems ok Reproduce code: --------------- function test( $filename ) { $xml = new DOMDocument(); $xml->load( $filename, LIBXML_NOBLANKS ); echo "\n$filename\n"; echo "Root of XML : " . $xml->firstChild->nodeName . "\n"; echo "First child of XML Root : " . $xml->firstChild->firstChild->nodeName . "\n"; $xpath = new DOMXpath( $xml ); echo "result of /mame/game xpath query : \n"; $r = $xpath->query("/mame/game"); for( $i=0; $i<$r->length; $i++ ) { echo $r->item($i)->nodeName . "\n"; } } test( "file_without_dtd.xml" ); test( "file_with_dtd.xml" ); Expected result: ---------------- with the two XML files: file_without_dtd.xml Root of XML : mame First child of XML Root : game result of /mame/game xpath query : game file_with_dtd.xml Root of XML : mame First child of XML Root : game result of /mame/game xpath query : game Actual result: -------------- file_without_dtd.xml Root of XML : mame First child of XML Root : game result of /mame/game xpath query : game file_with_dtd.xml Root of XML : mame First child of XML Root : result of /mame/game xpath query : game ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=47612&edit=1
