note 130416 added to class.xmlreader
| From: | infinitum11.dev@gmail.com | Date: | Mon, 14 Jul 2025 13:04:04 +0000 |
| Subject: | note 130416 added to class.xmlreader | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-222272@lists.php.net to get a copy of this message | ||
Be aware that the property "attributeCount" doesn't count #FIXED marked DTD
properties. Call the getAttribute method to get the default value.
```XML
# file.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE user [
<!ELEMENT user (#PCDATA)>
<!ATTLIST user
race CDATA #FIXED "human">
]>
<user>John</user>
```
<?php
$reader = XMLReader::open('file.xml');
$reader->read(); // nodeType === XMLReader::DOC_TYPE
$reader->read(); // nodeType === XMLReader::ELEMENT
echo $reader->attributeCount, PHP_EOL; // 0
echo $reader->getAttribute('race'), PHP_EOL; // "human"
?>
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.137 (proxied: 84.55.60.33)
----
Manual Page -- https://php.net/manual/en/class.xmlreader.php
Edit -- https://main.php.net/note/edit/130416
Del: integrated -- https://main.php.net/note/delete/130416/integrated
Del: useless -- https://main.php.net/note/delete/130416/useless
Del: bad code -- https://main.php.net/note/delete/130416/bad+code
Del: spam -- https://main.php.net/note/delete/130416/spam
Del: non-english -- https://main.php.net/note/delete/130416/non-english
Del: in docs -- https://main.php.net/note/delete/130416/in+docs
Del: other reasons-- https://main.php.net/note/delete/130416
Reject -- https://main.php.net/note/reject/130416
Search -- https://main.php.net/manage/user-notes.php