From:             mbishton at yahoo dot com
Operating system: Windows XP Prof. Version 5.1.260
PHP version:      5.0.3
PHP Bug Type:     SimpleXML related
Bug description:  cannot parse elements with dashes in names

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 bug report at http://bugs.php.net/?id=32544&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=32544&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=32544&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=32544&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=32544&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=32544&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=32544&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=32544&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=32544&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=32544&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=32544&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=32544&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=32544&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=32544&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=32544&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=32544&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=32544&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=32544&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=32544&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=32544&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=32544&r=mysqlcfg

Reply via email to