Skip to content

[Serializer] Add missing XML serializer's CDATA options #19883

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions components/serializer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1200,11 +1200,17 @@ Option Description
``remove_empty_tags`` If set to true, removes all empty tags in the ``false``
generated XML
``cdata_wrapping`` If set to false, will not wrap any value ``true``
containing one of the following characters (
``<``, ``>``, ``&``) in `a CDATA section`_ like
following: ``<![CDATA[...]]>``
matching the ``cdata_wrapping_pattern`` regex in
`a CDATA section`_ like following:
``<![CDATA[...]]>``
``cdata_wrapping_pattern`` A regular expression pattern to determine if a ``/[<>&]/``
value should be wrapped in a CDATA section
============================== ================================================= ==========================

.. versionadded:: 7.1

The `cdata_wrapping_pattern` option was introduced in Symfony 7.1.

Example with custom ``context``::

use Symfony\Component\Serializer\Encoder\XmlEncoder;
Expand Down
Loading