#[Package('system-settings')]
class XmlFileWriter extends AbstractFileWriter
{ public function append(Config
$config, array
$data, int
$index): void
{ if ($index === 0
) { fwrite($this->buffer, "<?xml version=\"1.0\"?><root>\n"
);
} $item =
new \
SimpleXMLElement('<item/>'
);
$this->
addDataToNode($item,
$data);
/** @var string $xml */
$xml =
mb_strstr($item->
asXML(), '<item>'
);
fwrite($this->buffer,
$xml);
} public function finish(Config
$config, string
$targetPath): void
{ fwrite($this->buffer, "</root>\n"
);
parent::
finish($config,
$targetPath);
}