lundi 25 septembre 2017

Avoid HTML encoding in JMS\Serializer - Laravel

I am new to handle XML. I have created an XML using JMS\Serializer.

$serializer = \JMS\Serializer\SerializerBuilder::create()->build();

$payload = $serializer->serialize($data, 'xml');

I try to serialize the $data array in to XML and pass it as a payload to a service/API. I am doing this in laravel 5.x.

The only problem I am unable to solve is that I need to avoid html encoding of special characters in the $payload XML as I need to pass the string 'a&b' as '<Name>a&b</Name>' instead of the default '<Name>a&amp;b</Name>'.

Thanks in advance.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire