private function createXMLDoc(Database $database)
    {
        $doc = new DOMDocument('1.0', 'utf-8');
        $doc->formatOutput = true; // pretty printing
        $doc->appendChild($doc->createComment("Created by PropelDataDumpTask."));

        $dsNode = $doc->createElement("dataset");
        $dsNode->setAttribute("name", "all");
        $doc->appendChild($dsNode);

        $platform = $this->getGeneratorConfig()->getConfiguredPlatform($this->conn);

        $this->log("Building DOM tree containing data from tables:");

        foreach ($database->getTables() as $tbl) {
            $this->log("\t+ " . $tbl->getName());
            $stmt = $this->getTableDataStmt($tbl->getName(), $platform);
            while ($row = $stmt->fetch()) {
                $rowNode = $doc->createElement($tbl->getPhpName());
                foreach ($tbl->getColumns() as $col) {
                    $cval = $row[$col->getName()];
                    if ($cval !== null) {
                        $rowNode->setAttribute($col->getPhpName(), iconv($this->dbEncoding, 'utf-8', $cval));
                    }
                }
                $dsNode->appendChild($rowNode);
                unset($rowNode);
            }
            unset($stmt);
        }

        return $doc;
    }