Skip to content

[Serializer] Add documentation about a new XmlEncoder CDATA wrapping opt-out context option #18155

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
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
9 changes: 9 additions & 0 deletions components/serializer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1206,8 +1206,16 @@ Option Description
``save_options`` XML saving `options with libxml`_ ``0``
``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[...]]>``
============================== ================================================= ==========================

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a versionadded directive, you can find some as example in other files

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

.. versionadded:: 6.4

The `cdata_wrapping` option was introduced in Symfony 6.4.

Example with custom ``context``::

use Symfony\Component\Serializer\Encoder\XmlEncoder;
Expand Down Expand Up @@ -1936,3 +1944,4 @@ Learn more
.. _`data URI`: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs
.. _seld/jsonlint: https://github.com/Seldaek/jsonlint
.. _$flags: https://www.php.net/manual/en/json.constants.php
.. _`a CDATA section`: https://en.wikipedia.org/wiki/CDATA
Loading