|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-04-28 08:48 UTC] pierre dot php at gmail dot com
[2006-04-28 08:57 UTC] dennis at inmarket dot lviv dot ua
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 20 20:00:01 2025 UTC |
Description: ------------ XMLReader never returns XMLReader::XML_DECLARATION nodes in a call to XMLReader::read() (silently skips them, however, complains about well-formedness if the XML declaration is not at the very beginning of the XML, ie, after a comment or the DTD). In addition to that, PHP6 does not recognize the call to XML() method and complains: PHP Warning: XMLReader::read(): Load Data before trying to read in [filename:linenumber] Reproduce code: --------------- <?php $xmld = <<<EOT <?xml version="1.0" encoding="UTF-8" ?> <!-- Prolog comment 1--> <!DOCTYPE chapter [ <!ELEMENT chapter (title,para+)> <!ELEMENT title (#PCDATA)> <!ELEMENT para (#PCDATA)> ]> <!-- prolog comment 2--> <!-- prolog comment 3--> <chapter><title>Title</title><para>Para</para></chapter> EOT; $xml = new XMLReader(); $xml->XML($xmld); while($xml->read()) { echo "$xml->nodeType \n"; } ?> Expected result: ---------------- 17 <- the nodeType value for XMLReader::XML_DECLARATION 8 10 8 8 1 1 3 15 1 3 15 15 Actual result: -------------- 8 10 8 8 1 1 3 15 1 3 15 15