I have successfully been able to serialize objects into XML with Symfony Serializer. But I'm having trouble serializing and deserializing xml into simple types, for the xml shown below.
I've tried several things with XmlEncoder and Normalizer and nothing seems to work.
For example, the xml <response>Hello there</response>
needs to be deserialized into a string variable containing "Hello there".
Similarly, an xml array like the following deserializes to ['Hello World', 'Hello', 'Hi'].
<responses>
<response>Hello World</response>
<response>Hello </response>
<response>Hi</response>
</responses>
Is this even possible to achieve with Symfony Serializer, or do I have to write some custom code to handle this?
The serializer does also allow decoding data, which will most likely return an array which might have a usable structure for your use case.
$serializer->decode($data, 'xml')