#32544 [Opn->Bgs]: cannot parse elements with dashes in names
| From: | derick@php.net | Date: | Sat, 02 Apr 2005 15:28:00 +0000 |
| Subject: | #32544 [Opn->Bgs]: cannot parse elements with dashes in names | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-76213@lists.php.net to get a copy of this message | ||
ID: 32544
Updated by: derick@php.net
Reported By: mbishton at yahoo dot com
-Status: Open
+Status: Bogus
Bug Type: SimpleXML related
Operating System: Windows XP Prof. Version 5.1.260
PHP Version: 5.0.3
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.
.
Previous Comments:
------------------------------------------------------------------------
[2005-04-02 17:20:32] mbishton at yahoo dot com
Description:
------------
U.S. library of congress displays house voting activity in xml file.
For example: $xml =
simplexml_load_file('http://clerk.house.gov/evs/1999/roll610.xml')
;
Many of the elements have dashes in them. For example:
<totals-by-party-header>
<party-header>Party</party-header>
<yea-header>Yeas</yea-header>
<nay-header>Nays</nay-header>
<present-header>Answered Present</present-header>
<not-voting-header>Not Voting</not-voting-header>
Any reference to an element, like;
$xml->totals-by-party-header->party-header->yea-header
will not work.
Reproduce code:
---------------
It works just fine if the element does not have dashes in it, like:
simplexml_load_file('http://clerk.house.gov/evs/1999/roll610.xml')
;
$vmeta = $xml->xpath('//vote-metadata' );
echo 'congress = ' . $vmeta[0]->congress ;
In the following example, $test will produce an error.
simplexml_load_file('http://clerk.house.gov/evs/1999/roll610.xml')
;
$meta = $xml->xpath('//totals-by-party' );
$test = $meta[1]->yea-total ;
Expected result:
----------------
I expected it to return an array or the content of an element,
depending on what I was referencing.
Actual result:
--------------
Notice: Use of undefined constant total - assumed 'total' in C:\Program
Files\Apache2\htdocs\test01.php on line 9
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=32544&edit=1