note 100347 added to class.xmlreader
| From: | japos dot trash at googlemail dot com | Date: | Sat, 09 Oct 2010 21:17:02 +0000 |
| Subject: | note 100347 added to class.xmlreader | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-173107@lists.php.net to get a copy of this message | ||
Take care about how to use XMLReader::$isElementEmpty. I don't know if it is a bug or not, but
$isElementEmpty is set for the current context and NOT just for the element. If you move your cursor
to an attribute, $isElementEmpty will ALWAYS be false.
<?php
$xml = new XMLReader();
$xml->XML('<tag attr="value" />');
$xml->read();
var_dump($xml->isEmptyElement);
$xml->moveToNextAttribute();
var_dump($xml->isEmptyElement);
?>
will output
(bool) true
(bool) false
So be sure to store $isEmptyElement before moving the cursor.
----
Server IP: 69.147.83.197
Probable Submitter: 93.129.45.174
----
Manual Page -- http://www.php.net/manual/en/class.xmlreader.php
Edit -- https://master.php.net/note/edit/100347
Del: integrated -- https://master.php.net/note/delete/100347/integrated
Del: useless -- https://master.php.net/note/delete/100347/useless
Del: bad code -- https://master.php.net/note/delete/100347/bad+code
Del: spam -- https://master.php.net/note/delete/100347/spam
Del: non-english -- https://master.php.net/note/delete/100347/non-english
Del: in docs -- https://master.php.net/note/delete/100347/in+docs
Del: other reasons-- https://master.php.net/note/delete/100347
Reject -- https://master.php.net/note/reject/100347
Search -- https://master.php.net/manage/user-notes.php