|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-01-15 01:55 UTC] aharvey@php.net
[2010-01-15 01:56 UTC] aharvey@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Dec 07 05:00:01 2025 UTC |
Description: ------------ Using SimpleXML and SimpleXML_load_file to load an external XML file. The ::attributes feature does not recognize hyphens in attribute features, no documentation on how to resolve feature and the solution for dealing with hyphens in nodes (by putting it in curly braces and quotes {''}) does not solve the problem. This is my first time submitting a bug and I'm an amateur, but there is no documentation for a solution. Not sure if I selected the proper bug category. Sorry for any mistakes. Reproduce code: --------------- --- From manual page: simplexmlelement.attributes#Description --- portion of xml file (parent nodes left out for simplicity): <recorded-vote><legislator name-id="A000014" sort-field="Abercrombie" unaccented-name="Abercrombie" party="D" state="HI" role="legislator">Abercrombie</legislator><vote>Aye</vote></recorded-vote> ex. 1: echo {'recorded-vote'}[0]->legislator->attributes()->{'name-id'}; ex. 2: print_r ({'recorded-vote'}[0]->legislator->attributes()); Expected result: ---------------- ex. 1 A000014 ex. 2 SimpleXMLElement Object ( [@attributes] => Array ( [name-id] => A000014 [sort-field] => Abercrombie [unaccented-name] => Abercrombie [party] => D [state] => HI [role] => legislator ) ) Actual result: -------------- ex. 1 0 To clarify, all that outputs is the digit zero. ex. 2 SimpleXMLElement Object ( [@attributes] => Array ( [party] => D [state] => HI [role] => legislator ) )