How can I bind an arbitrary element to CDATA in XML_Serializer serialization?

$serializer = new XML_Serializer($options); 
$serializer->serialize($some_array);
$output = $serializer->getSerializedData();

      

I want to surround an arbitrary element generating XML with the above string in CDATA, but I cannot do that. Is there a good method?

XML_SERIALIZER_OPTION_CDATA_SECTIONS = true

      

When I used it with this option, CDATA sticks to all data.

0


a source to share


1 answer


Just put cdata tags around the text you want to see in cdata and turn off the automatic cdata option.



0


a source







All Articles