private function getProperties(PhingFile $file)
    {
        // load() already made sure that file is readable
        // but we'll double check that when reading the file into
        // an array

        if ((@file($file)) === false) {
            throw new IOException("Unable to parse contents of $file");
        }

        $prop = new Properties();

        $xml = simplexml_load_string(file_get_contents($file));

        if ($xml === false) {
            throw new IOException("Unable to parse XML file $file");
        }

        $path = [];

        if ($this->keepRoot) {
            $path[] = dom_import_simplexml($xml)->tagName;

            $prefix = implode('.', $path);

            if (!empty($prefix)) {
                $prefix .= '.';
            }

            // Check for attributes
            foreach ($xml->attributes() as $attribute => $val) {
                if ($this->collapseAttr) {
                    $prop->setProperty($prefix . (string) $attribute, (string) $val);
                } else {
                    $prop->setProperty($prefix . "($attribute)", (string) $val);
                }
            }
        }

        $this->addNode($xml, $path, $prop);

        return $prop;
    }