#44472 [Opn]: SimpleXMLElement() drops nodes
| From: | felipe@php.net | Date: | Wed, 19 Mar 2008 00:18:05 +0000 |
| Subject: | #44472 [Opn]: SimpleXMLElement() drops nodes | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-123448@lists.php.net to get a copy of this message | ||
ID: 44472
Updated by: felipe@php.net
Reported By: jsafley at gmu dot edu
Status: Open
Bug Type: SimpleXML related
Operating System: Linux
PHP Version: 5.2.5
New Comment:
This output seems expected, see this article:
http://devzone.zend.com/node/view/id/688#Heading3
Previous Comments:
------------------------------------------------------------------------
[2008-03-18 19:17:55] jsafley at gmu dot edu
Description:
------------
new SimpleXMLElement() drops namespaced nodes.
Reproduce code:
---------------
$xmlstr = <<<XML
<OAI-PMH>
<ListRecords>
<record>
<metadata>
<oai_dc:dc
xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<dc:title>A comparative study</dc:title>
<dc:creator>Talabi, A.O.</dc:creator>
<dc:publisher>African Journal</dc:publisher>
<dc:date>1970-01-01</dc:date>
</oai_dc:dc>
</metadata>
</record>
</ListRecords>
</OAI-PMH>
XML;
$xml = new SimpleXMLElement($xmlstr);
print_r($xml);
Expected result:
----------------
SimpleXMLElement Object
(
[ListRecords] => SimpleXMLElement Object (
[record] => SimpleXMLElement Object (
[metadata] => SimpleXMLElement Object(
[dc] => SimpleXMLElement Object (
[title] => SimpleXMLElement Object (
A comparative study
)
[creator] => SimpleXMLElement Object (
Talabi, A.O.
)
[publisher] => SimpleXMLElement Object (
African Journal
)
[date] => SimpleXMLElement Object (
1970-01-01
)
)
)
)
)
)
Actual result:
--------------
SimpleXMLElement Object
(
[ListRecords] => SimpleXMLElement Object (
[record] => SimpleXMLElement Object (
[metadata] => SimpleXMLElement Object(
)
)
)
)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=44472&edit=1