|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2004-12-02 21:02 UTC] theseer@php.net
Description:
------------
When using $node->set_attribute on a previously existing attribute with a namespace, the attribute gets doubled rather then updated - interestingly enough, a second update does update the "doubled" attribute just fine...
Additionally, $node->remove_attribute('test:attrib'); doesn't work with the previously existing attribute either while it removes the newly doubled attribute.
Reproduce code:
---------------
$dom=domxml_open_mem('<?xml version="1.0" ?><foo:root xmlns:test="http://test.de/xml" xmlns:foo="http://test.de/foo" test:attrib="0" />');
$root = $dom->document_element();
$root->set_attribute('test:attrib','1');
$root->set_attribute('test:attrib','2');
echo $dom->dump_mem();
Expected result:
----------------
<?xml version="1.0"?>
<foo:root xmlns:test="http://test.de/xml" xmlns:foo="http://test.de/foo" test:attrib="2"/>
Actual result:
--------------
<?xml version="1.0"?>
<foo:root xmlns:test="http://test.de/xml" xmlns:foo="http://test.de/foo" test:attrib="0" test:attrib="2"/>
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 09:00:01 2025 UTC |
Just found a "workaround" to avoid invalid xml: $root->remove_attribute('attrib'); That will remove the "original" attribute. Yes, without the namespace-prefix!