Edit report at http://bugs.php.net/bug.php?id=51525&edit=1
ID: 51525
User updated by: martin at aarhof dot eu
Reported by: martin at aarhof dot eu
Summary: Getting a node with a - in it
Status: Open
-Type: Bug
+Type: Feature/Change Request
Package: SimpleXML related
Operating System: Windows
PHP Version: 5.2.13
New Comment:
Solution is
echo $channel->{"display-name"};
Could this be fixed so you dont need the {} ?
Previous Comments:
------------------------------------------------------------------------
[2010-04-10 03:56:21] martin at aarhof dot eu
Description:
------------
If a XML node have a - in it you can't get the data from it
<display-name>
echo $channel->display-name;
Notice: Use of undefined constant name - assumed 'name'
Test script:
---------------
<?xml version="1.0" encoding="UTF-8" ?>
<tv generator-info-name="www.ontv.dk/xmltv">
<channel id="www.ontv.dk/tv/1">
<display-name lang="dk">DR1 DK</display-name>
</channel>
</tv>
$xml = simplexml_load_string($xml);
$channels = $this->xml->xpath('//channel');
foreach($channels AS $channel) {
echo $channel->display-name;
}
Expected result:
----------------
DR1 DK
Actual result:
--------------
Notice: Use of undefined constant name - assumed 'name'
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=51525&edit=1