Bug #33305 [Com]: appendChild adds additionnal namespace on wrong node
Edit report at https://bugs.php.net/bug.php?id=33305&edit=1
ID: 33305
Comment by: kerzoloc at free dot fr
Reported by: francois dot proulx at gmail dot com
Summary: appendChild adds additionnal namespace on wrong node
Status: Not a bug
Type: Bug
Package: *XML functions
Operating System: Linux Mandrake 10.1
PHP Version: 5.0.4
Block user comment: N
Private report: N
New Comment:
appending's order is important:
$root->appendChild($get_record_node);
$get_record_node->appendChild($record_node);
$record_node->appendChild($metadata_node);
$metadata_node->appendChild($node_bug);
<?xml version="1.0"?>
<OAI-PMH xmlns="http://www.openarchives.org/OAI/2.0/">
<GetRecord>
<record>
<metadata>
<lom_prefix:lom xmlns:lom_prefix="http://ltsc.ieee.org/xsd/LOM"/>
</metadata>
</record>
</GetRecord>
</OAI-PMH>
Bien cordialement
Erwan
Previous Comments:
------------------------------------------------------------------------
[2005-06-10 19:02:26] rrichards@php.net
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.
There are a few issues with namespace reconciliation in libxml. They are currently being addressed.
In any case the two documents (expected and actual results) although not identical have the same
meaning.
------------------------------------------------------------------------
[2005-06-10 18:10:03] francois dot proulx at gmail dot com
Description:
------------
When adding a node with a different namespace on the second or third level of a DOM tree. DOM adds
additionnal namespace declaration to the upper levels where it shoul'nt.
I'm using libxml 2.6.17 or 2.6.19 (same issue). DOM/XML API Version 20031129.
Reproduce code:
---------------
$document = new DomDocument();
$root = $document->createElementNS(OAI_PMH_NS, "OAI-PMH");
$document->appendChild($root);
$get_record_node = $document->createElementNS(OAI_PMH_NS, "GetRecord");
$record_node = $document->createElementNS(OAI_PMH_NS, "record");
$metadata_node = $document->createElementNS(OAI_PMH_NS, "metadata");
$node_bug = $document->createElementNS(LOM_EXPORT_NS, "lom_prefix:lom");
$record_node->appendChild($metadata_node);
$metadata_node->appendChild($node_bug);
$get_record_node->appendChild($record_node);
$root->appendChild($get_record_node);
Expected result:
----------------
<?xml version="1.0"?>
<OAI-PMH xmlns="http://www.openarchives.org/OAI/2.0/">
<GetRecord>
<record>
<metadata>
<lom_prefix:lom xmlns:lom_prefix="http://ltsc.ieee.org/xsd/LOM"/>
</metadata>
</record>
</GetRecord>
</OAI-PMH>
Actual result:
--------------
<?xml version="1.0"?>
<OAI-PMH xmlns="http://www.openarchives.org/OAI/2.0/">
<GetRecord xmlns:lom_prefix="http://ltsc.ieee.org/xsd/LOM">
<record xmlns:lom_prefix="http://ltsc.ieee.org/xsd/LOM">
<metadata>
<lom_prefix:lom xmlns:lom_prefix="http://ltsc.ieee.org/xsd/LOM"/>
</metadata>
</record>
</GetRecord>
</OAI-PMH>
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=33305&edit=1
Thread (3 messages)