diff --git a/src/AbstractElement.php b/src/AbstractElement.php index b9cd3e5..7e5d3c8 100644 --- a/src/AbstractElement.php +++ b/src/AbstractElement.php @@ -230,6 +230,10 @@ public static function getChildrenOfClass(DOMElement $parent): array && $node->namespaceURI === static::getNamespaceURI() && $node->localName === static::getLocalName() ) { + // Normalize the DOMElement by importing it into a clean empty document + $newDoc = DOMDocumentFactory::create(); + $node = $newDoc->appendChild($newDoc->importNode($node, true)); + $ret[] = static::fromXML($node); } }