note 126408 added to class.domcomment
| From: | npelov at croler dot net | Date: | Thu, 09 Sep 2021 16:41:52 +0000 |
| Subject: | note 126408 added to class.domcomment | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-216940@lists.php.net to get a copy of this message | ||
Note that textContent property of a comment is not entity decoded, it is decoded in
DOMElement::textContent :
<?php
$xml = new DOMDocument();
$xml->loadXML('<?xml version="1.0" encoding="utf-8"?>
<configuration version="2">
<!-- test --> -->
test -->
</configuration>'
);
$xpath = new DOMXPath($xml);
$comments = $xpath->query('//comment()');
$elements = $xpath->query('//configuration');
echo $comments[0]->textContent;
// result: test -->
echo $elements[0]->textContent;
// result: test -->
?>
----
Server IP: 45.112.84.4
Probable Submitter: 45.112.85.242 (proxied: 85.11.146.60)
----
Manual Page -- https://php.net/manual/en/class.domcomment.php
Edit -- https://main.php.net/note/edit/126408
Del: integrated -- https://main.php.net/note/delete/126408/integrated
Del: useless -- https://main.php.net/note/delete/126408/useless
Del: bad code -- https://main.php.net/note/delete/126408/bad+code
Del: spam -- https://main.php.net/note/delete/126408/spam
Del: non-english -- https://main.php.net/note/delete/126408/non-english
Del: in docs -- https://main.php.net/note/delete/126408/in+docs
Del: other reasons-- https://main.php.net/note/delete/126408
Reject -- https://main.php.net/note/reject/126408
Search -- https://main.php.net/manage/user-notes.php