From 8d9904760e6522b3cf75f160dced6d5cf8ac6fe7 Mon Sep 17 00:00:00 2001 From: Henry Snoek Date: Fri, 20 Apr 2018 15:38:55 +0200 Subject: [PATCH 1/2] example for processing XML comments when decoding --- components/serializer.rst | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/components/serializer.rst b/components/serializer.rst index 7ecdd7cd8da..bcb16a18763 100644 --- a/components/serializer.rst +++ b/components/serializer.rst @@ -704,6 +704,27 @@ always as a collection. .. versionadded:: 4.1 The ``as_collection`` option was introduced in Symfony 4.1. +.. tip:: + + Processing of XML comments can be controlled with the third constructor + argument: + + .. code-block:: php + + class XmlEncoder + { + public function __construct( + string $rootNodeName = 'response', + int $loadOptions = null, + array $ignoredNodeTypes = array(XML_PI_NODE, XML_COMMENT_NODE) + ) { + // ... + } + } + +.. versionadded:: 4.1 + XML comments are removed by default since Symfony 4.1. + The ``YamlEncoder`` ~~~~~~~~~~~~~~~~~~~ From dc01b877dbfd7c48278474fdc580e2652b684bae Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 27 Apr 2018 09:30:35 +0200 Subject: [PATCH 2/2] Reword --- components/serializer.rst | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/components/serializer.rst b/components/serializer.rst index bcb16a18763..c7fba3c0811 100644 --- a/components/serializer.rst +++ b/components/serializer.rst @@ -706,24 +706,12 @@ always as a collection. .. tip:: - Processing of XML comments can be controlled with the third constructor - argument: + XML comments are ignored by default when decoding contents, but this + behavior can be changed with the optional ``$ignoredNodeTypes`` argument of + the ``XmlEncoder`` class constructor. - .. code-block:: php - - class XmlEncoder - { - public function __construct( - string $rootNodeName = 'response', - int $loadOptions = null, - array $ignoredNodeTypes = array(XML_PI_NODE, XML_COMMENT_NODE) - ) { - // ... - } - } - -.. versionadded:: 4.1 - XML comments are removed by default since Symfony 4.1. + .. versionadded:: 4.1 + XML comments are ignored by default starting from Symfony 4.1. The ``YamlEncoder`` ~~~~~~~~~~~~~~~~~~~