Bug #66684 [Opn->Dup]: Issue with recurring elements and attributes
| From: | cmb@php.net | Date: | Tue, 08 Sep 2015 16:28:15 +0000 |
| Subject: | Bug #66684 [Opn->Dup]: Issue with recurring elements and attributes | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-195881@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=66684&edit=1
ID: 66684
Updated by: cmb@php.net
Reported by: rasmus at 3kings dot dk
Summary: Issue with recurring elements and attributes
-Status: Open
+Status: Duplicate
Type: Bug
Package: SimpleXML related
PHP Version: Irrelevant
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Actually, this is a duplicate of bug #44973. To see the attributes
of the <specification> element, you have to iterate over
::attributes(). print_r() won't show them.
Previous Comments:
------------------------------------------------------------------------
[2014-02-10 12:31:14] rasmus at 3kings dot dk
Description:
------------
I have an XML file <http://www.mercurymarine.dk/public/export/XMLalleprodukter.xml>
with a recurrence of the element <specification>. When loaded in SimpleXML i get the following
structure (note that the top level has attributes defined whereas <specification> does not).
---
From manual page: http://www.php.net/simplexmlelement.attributes
---
Test script:
---------------
print_r(SimpleXMLElement(file_get_contents("http://www.mercurymarine.dk/public/export/XMLalleprodukter.xml")));
Expected result:
----------------
... something that allows me to read the attributes of the <specification> elements.
Actual result:
--------------
SimpleXMLElement Object
(
[@attributes] => Array
(
[type] => Påhængsmotorer
[id] => 17827
[produkttype] => nyt
[forhandlertype] => importør
)
[title] => Mercury 30MLH 2-takt
[dealer_name] => SimpleXMLElement Object
(
)
[dealer_address] => Sundvej 12 F
[dealer_postalcode] => 4600
[dealer_city] => Køge
[dealer_email] => mads@jdas.dk
[dealer_phone] => 4049 2920
[dealer_webadresse] => www.mercurymarine.dk
[description] => Sælges kun til erhvervsbrug. MED/SOLAS godkendt. Download godkendelses
certifikat fra højre spalte.
[price] => 27120.00
[url] =>
www.mercurymarine.dk/produkter/motorer/solasogmedgodkendtepaahaengsmotorer/mercurymedsolag2-taktmotorer/me-30mlh.html
[picture] => Array
(
[0] => http://www.mercurymarine.dk/public/billeder/produkter-jpg/Motorer/Mercury/ME_2takt/ME_2takt30cc429/Me$2s$F250-2_5$30cc429.jpg
[1] => http://www.mercurymarine.dk/gfx/imager/produkter-jpg/Motorer/Mercury/ME_2takt/ME_2takt30cc429/Me$2s$F250-2_5$30cc429.jpg?s=product
)
[specification] => Array
(
[0] => Påhængsmotor
[1] => 1,92:1
[2] => 508mm
[3] => 30.00
[4] => 6
[5] => F-F-B
[6] => 2
[7] => 22,1
[8] => 429
[9] => 51
[10] => 6
[11] => Manuel
[12] => 4800-5500
[13] => Styrehåndtag
[14] => 1 karburator
[15] => 2-takt
[16] => for fejl og ændringer i specifikationerne
)
)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=66684&edit=1