diff --git a/lib/FSi/DoctrineExtensions/Mapping/Driver/AbstractXmlDriver.php b/lib/FSi/DoctrineExtensions/Mapping/Driver/AbstractXmlDriver.php index 42e02c1..120928d 100644 --- a/lib/FSi/DoctrineExtensions/Mapping/Driver/AbstractXmlDriver.php +++ b/lib/FSi/DoctrineExtensions/Mapping/Driver/AbstractXmlDriver.php @@ -98,8 +98,10 @@ private function validateFile(DOMDocument $dom) continue; } - foreach ($dom->getElementsByTagNameNS($xmlns->nodeValue, '*') as $elem) { - $elem->parentNode->removeChild($elem); + $domNodeList = $dom->getElementsByTagNameNS($xmlns->nodeValue, '*'); + for ($i = $domNodeList->length; --$i >= 0; ) { + $element = $domNodeList->item($i); + $element->parentNode->removeChild($element); } }