Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workaround for namespace definition removal #80

Closed
ThomasWeinert opened this issue Nov 14, 2018 · 0 comments
Closed

Workaround for namespace definition removal #80

ThomasWeinert opened this issue Nov 14, 2018 · 0 comments
Assignees
Milestone

Comments

@ThomasWeinert
Copy link
Owner

DOMElement::setAttributeNS() seems to remove used namespace definitions if the attribute name equals the namespace prefix.

$document = new DOMDocument();
$document->appendChild($document->createElement('foo'));
$document->documentElement->setAttributeNS('urn:bar', 'bar:bar', '42');
$document->documentElement->setAttributeNS('urn:bar', 'bar:foobar', '42');
$document->documentElement->removeAttributeNS('urn:bar', 'bar');
echo $document->saveXML();

Additoinally using the XML namespaces URI seems no to remove namespace definitions

$document = new DOMDocument();
$document->appendChild($document->createElement('foo'));
$document->documentElement->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:bar', 'urn:example');
$document->documentElement->removeAttributeNS('http://www.w3.org/2000/xmlns/', 'bar');
echo $document->saveXML();

FluentDOM should contain tests and implement a workround.

@ThomasWeinert ThomasWeinert self-assigned this Nov 14, 2018
ThomasWeinert added a commit that referenced this issue Dec 3, 2018
Implement: make FluentDOM\DOM\Xpath::quote() a static function
@ThomasWeinert ThomasWeinert added this to the 7.2 milestone May 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant