We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c47e705 commit a6e8143Copy full SHA for a6e8143
src/Attribute.php
@@ -106,6 +106,14 @@ public static function fromXML(DOMAttr $attr): static
106
*/
107
public function toXML(DOMElement $parent): DOMElement
108
{
109
+ if ($this->getNamespaceURI() !== null && !$parent->lookupPrefix($this->getNamespacePrefix())) {
110
+ $parent->setAttributeNS(
111
+ 'http://www.w3.org/2000/xmlns/',
112
+ 'xmlns:' . $this->getNamespacePrefix(),
113
+ $this->getNamespaceURI(),
114
+ );
115
+ }
116
+
117
$parent->setAttributeNS(
118
$this->getNamespaceURI(),
119
!in_array($this->getNamespacePrefix(), ['', null])
0 commit comments