public function load($file = null, $format = null)
    {
        $file = $file ? $file : $this->file;
        $format = $format !== null ? $format : $this->format;
        $this->value = array();

        if (!is_readable($file)) {
            throw IOException::notReadable($file);
        }

        switch ($format) {
            case CFPropertyList::FORMAT_BINARY:
                $this->readBinary($file);
                break;
            case CFPropertyList::FORMAT_AUTO: // what we now do is ugly, but neccessary to recognize the file format
                $fd = fopen($file, "rb");
                if (($magic_number = fread($fd, 8)) === false) {
                    throw IOException::notReadable($file);
                }
                fclose($fd);

                $filetype = substr($magic_number, 0, 6);
                $version  = substr($magic_number, -2);

                if ($filetype == "bplist") {
                    if ($version != "00") {
                        throw new PListException("Wrong file format version! Expected 00, got $version!");
                    }
                    $this->detectedFormat = CFPropertyList::FORMAT_BINARY;
                    $this->readBinary($file);
                    break;
                }
                $this->detectedFormat = CFPropertyList::FORMAT_XML;
              // else: xml format, break not neccessary
            case CFPropertyList::FORMAT_XML:
                $doc = new DOMDocument();
                $prevXmlErrors = libxml_use_internal_errors(true);
                libxml_clear_errors();
                if (!$doc->load($file)) {
                    $message = $this->getLibxmlErrors();
                    libxml_clear_errors();
                    libxml_use_internal_errors($prevXmlErrors);
                    throw new DOMException($message);
                }
                libxml_use_internal_errors($prevXmlErrors);
                $this->import($doc->documentElement, $this);
                break;
        }
    }