Bug #67901 [Opn->Nab]: getElementsByTagname('link') does not work
| From: | requinix@php.net | Date: | Mon, 25 Aug 2014 21:36:30 +0000 |
| Subject: | Bug #67901 [Opn->Nab]: getElementsByTagname('link') does not work | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-187272@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=67901&edit=1
ID: 67901
Updated by: requinix@php.net
Reported by: noxtras at gmail dot com
Summary: getElementsByTagname('link') does not work
-Status: Open
+Status: Not a bug
Type: Bug
Package: DOM XML related
Operating System: Centos
PHP Version: 5.4.32
Block user comment: N
Private report: N
New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
for you.
Thank you for your interest in PHP.
I can assure you that the quoting style makes absolutely no difference between 'link' and
"link". Maybe you're using a variable instead of a literal value?
Keep checking your code for bugs.
Previous Comments:
------------------------------------------------------------------------
[2014-08-25 13:37:28] noxtras at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/domdocument.getelementsbytagname
---
There is a difference between
$node->getElementsByTagname("link")->item(0)->textContent
and
$node->getElementsByTagname('link')->item(0)->textContent
the second one returns am empty string!
Test script:
---------------
$xml = file_get_contents('http://feeds.bbci.co.uk/news/uk/rss.xml?edition=uk');
$dom = new domDocument;
$dom->loadXML($xml);
$dom->preserveWhiteSpace = false;
$items = $dom->getElementsByTagname('item');
foreach ($items as $k=>$node) {
//this works
echo '<br>link: ' .
$node->getElementsByTagname("link")->item(0)->textContent;
//this does NOT work (returns empty string
echo '<br>link: ' .
$node->getElementsByTagname('link')->item(0)->textContent;
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=67901&edit=1