protected function logBadXML($xml)
    {
        $file = @fopen($this->badXmlLog, 'a');
        if (!$file) {
            throw new \Exception("Problem opening {$this->badXmlLog}.");
        }
        fputs($file, $xml . "\n\n");
        fclose($file);
    }