I use Symfony 3 Serializer and convert my objects to XML through XmlEncoder. But XmlEncoder don't have encoding type in xml prolog. How to solve this problem?
Can I add custom attribut with parameters after root element?
Is there any way to set xmlns in root element?
I need such XML output:
<?xml version="1.0" encoding="utf-8"?>
<realty-feed xmlns="http://webmaster.yandex.ru/schemas/feed/realty/2010-06">
<generation-date>2010-10-05T16:36:00+04:00</generation-date>
...
</realty-feed>
Now I get this:
<?xml version="1.0"?>
<realty-feed>
...
</realty-feed>
My serializer code fragment:
$xmlEncoder = new XmlEncoder('realty-feed');
$normalizer = new CustomNormalizer();
$serializer = new Serializer(array($normalizer),array($xmlEncoder));
$output = $serializer->serialize($objectData, 'xml');