diff --git a/src/XML/SignedElementTrait.php b/src/XML/SignedElementTrait.php index 5cafec5b..3cfabd3c 100644 --- a/src/XML/SignedElementTrait.php +++ b/src/XML/SignedElementTrait.php @@ -143,9 +143,7 @@ private function validateReference(SignedInfo $signedInfo): SignedElementInterfa } // Clone the document so we don't mess up the original DOMDocument - $doc = DOMDocumentFactory::create(); - $node = $doc->importNode($xml->ownerDocument->documentElement, true); - $doc->appendChild($node); + $doc = DOMDocumentFactory::fromString($xml->ownerDocument->saveXML($xml->ownerDocument->documentElement)); $xp = XPath::getXPath($doc); $sigNode = XPath::xpQuery($doc->documentElement, 'child::ds:Signature', $xp);