From a3639506425e479b4574c5eb0ab26368c6a6e592 Mon Sep 17 00:00:00 2001 From: Adrien Moiraud Date: Wed, 7 Dec 2016 11:45:14 +0100 Subject: [PATCH 1/7] Add XmlEncoder documentation with $context available options --- components/serializer.rst | 56 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/components/serializer.rst b/components/serializer.rst index 22b8463de66..a7db6252cb2 100644 --- a/components/serializer.rst +++ b/components/serializer.rst @@ -674,6 +674,62 @@ you indicate that you're expecting an array instead of a single object. $data = ...; // The serialized data from the previous example $persons = $serializer->deserialize($data, 'Acme\Person[]', 'json'); + +The ``XmlEncoder`` +----------------------- + +This encoder transforms arrays into XML and vice versa. + +For example, take an object normalized as following:: + + array('foo' => array(1, 2), 'bar' => true); + +The ``XmlEncoder`` will encode this object like that:: + + + + 1 + 2 + 1 + + +Be aware that this encoder will consider keys beginning with ``@`` as attributes:: + + $encoder = new XmlEncoder(); + $encoder->encode(array('foo' => array('@bar' => 'value'))); + // will return: + // + // + // + // + +Context +~~~~~~~~~~~~~~~ + +The context param is an array of additional options for the XmlEncoder. +It must be defined in the call of XmlEncoder encode() method : + + $xmlEncoder->encode($array, 'xml', $context); + +**Available params :** + +``xml_format_output`` +If setted to true, format the output XML with line break and indentation + +``xml_version`` +Change the XML version attribute + +``xml_encoding`` +Change the XML encoding attribute + +``xml_standalone`` +Add standalone attribute in XML output + +``remove_empty_tags`` +If setted to true, remove all empty tags in the XML output + +``xml_root_node_name`` +Change the root node name (default : response) Learn more ---------- From 7d4da297c2f422af29411756fc5a0aa742fe1270 Mon Sep 17 00:00:00 2001 From: Adrien Moiraud Date: Wed, 7 Dec 2016 11:45:34 +0100 Subject: [PATCH 2/7] erratum --- components/serializer.rst | 56 --------------------------------------- 1 file changed, 56 deletions(-) diff --git a/components/serializer.rst b/components/serializer.rst index a7db6252cb2..22b8463de66 100644 --- a/components/serializer.rst +++ b/components/serializer.rst @@ -674,62 +674,6 @@ you indicate that you're expecting an array instead of a single object. $data = ...; // The serialized data from the previous example $persons = $serializer->deserialize($data, 'Acme\Person[]', 'json'); - -The ``XmlEncoder`` ------------------------ - -This encoder transforms arrays into XML and vice versa. - -For example, take an object normalized as following:: - - array('foo' => array(1, 2), 'bar' => true); - -The ``XmlEncoder`` will encode this object like that:: - - - - 1 - 2 - 1 - - -Be aware that this encoder will consider keys beginning with ``@`` as attributes:: - - $encoder = new XmlEncoder(); - $encoder->encode(array('foo' => array('@bar' => 'value'))); - // will return: - // - // - // - // - -Context -~~~~~~~~~~~~~~~ - -The context param is an array of additional options for the XmlEncoder. -It must be defined in the call of XmlEncoder encode() method : - - $xmlEncoder->encode($array, 'xml', $context); - -**Available params :** - -``xml_format_output`` -If setted to true, format the output XML with line break and indentation - -``xml_version`` -Change the XML version attribute - -``xml_encoding`` -Change the XML encoding attribute - -``xml_standalone`` -Add standalone attribute in XML output - -``remove_empty_tags`` -If setted to true, remove all empty tags in the XML output - -``xml_root_node_name`` -Change the root node name (default : response) Learn more ---------- From b09a22d8ad10e2ac923f6e6c6beac3648f311446 Mon Sep 17 00:00:00 2001 From: Adrien Moiraud Date: Wed, 7 Dec 2016 11:46:40 +0100 Subject: [PATCH 3/7] Add XmlEncoder documentation with $context available options --- components/serializer.rst | 56 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/components/serializer.rst b/components/serializer.rst index 22b8463de66..a7db6252cb2 100644 --- a/components/serializer.rst +++ b/components/serializer.rst @@ -674,6 +674,62 @@ you indicate that you're expecting an array instead of a single object. $data = ...; // The serialized data from the previous example $persons = $serializer->deserialize($data, 'Acme\Person[]', 'json'); + +The ``XmlEncoder`` +----------------------- + +This encoder transforms arrays into XML and vice versa. + +For example, take an object normalized as following:: + + array('foo' => array(1, 2), 'bar' => true); + +The ``XmlEncoder`` will encode this object like that:: + + + + 1 + 2 + 1 + + +Be aware that this encoder will consider keys beginning with ``@`` as attributes:: + + $encoder = new XmlEncoder(); + $encoder->encode(array('foo' => array('@bar' => 'value'))); + // will return: + // + // + // + // + +Context +~~~~~~~~~~~~~~~ + +The context param is an array of additional options for the XmlEncoder. +It must be defined in the call of XmlEncoder encode() method : + + $xmlEncoder->encode($array, 'xml', $context); + +**Available params :** + +``xml_format_output`` +If setted to true, format the output XML with line break and indentation + +``xml_version`` +Change the XML version attribute + +``xml_encoding`` +Change the XML encoding attribute + +``xml_standalone`` +Add standalone attribute in XML output + +``remove_empty_tags`` +If setted to true, remove all empty tags in the XML output + +``xml_root_node_name`` +Change the root node name (default : response) Learn more ---------- From 0feac818316067520164e8799fb54a48b4c7c999 Mon Sep 17 00:00:00 2001 From: Adrien Moiraud Date: Wed, 7 Dec 2016 11:58:49 +0100 Subject: [PATCH 4/7] Correcting my bad english with a bilingual friend --- components/serializer.rst | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/components/serializer.rst b/components/serializer.rst index a7db6252cb2..e8163a35758 100644 --- a/components/serializer.rst +++ b/components/serializer.rst @@ -707,14 +707,15 @@ Context ~~~~~~~~~~~~~~~ The context param is an array of additional options for the XmlEncoder. -It must be defined in the call of XmlEncoder encode() method : + +It must be defined while calling the XmlEncoder encode() method : $xmlEncoder->encode($array, 'xml', $context); **Available params :** ``xml_format_output`` -If setted to true, format the output XML with line break and indentation +If set to true, format the output XML with line break and indentation ``xml_version`` Change the XML version attribute @@ -725,12 +726,12 @@ Change the XML encoding attribute ``xml_standalone`` Add standalone attribute in XML output -``remove_empty_tags`` -If setted to true, remove all empty tags in the XML output - ``xml_root_node_name`` Change the root node name (default : response) +``remove_empty_tags`` +If set to true, remove all empty tags in the XML output + Learn more ---------- From 0d8e7645779beffaa79d1a31ded5c21534eb0bb2 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 8 Dec 2016 09:30:16 +0100 Subject: [PATCH 5/7] Minor syntax issues and some rewordings --- components/serializer.rst | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/components/serializer.rst b/components/serializer.rst index e8163a35758..8859ed281ce 100644 --- a/components/serializer.rst +++ b/components/serializer.rst @@ -676,15 +676,16 @@ you indicate that you're expecting an array instead of a single object. $persons = $serializer->deserialize($data, 'Acme\Person[]', 'json'); The ``XmlEncoder`` ------------------------ - -This encoder transforms arrays into XML and vice versa. +------------------ -For example, take an object normalized as following:: +This encoder transforms arrays into XML and vice versa. For example, take an +object normalized as following:: array('foo' => array(1, 2), 'bar' => true); -The ``XmlEncoder`` will encode this object like that:: +The ``XmlEncoder`` encodes this object as follows: + +.. code-block:: xml @@ -693,7 +694,7 @@ The ``XmlEncoder`` will encode this object like that:: 1 -Be aware that this encoder will consider keys beginning with ``@`` as attributes:: +The array keys beginning with ``@`` are considered XML attributes:: $encoder = new XmlEncoder(); $encoder->encode(array('foo' => array('@bar' => 'value'))); @@ -704,33 +705,32 @@ Be aware that this encoder will consider keys beginning with ``@`` as attributes // Context -~~~~~~~~~~~~~~~ - -The context param is an array of additional options for the XmlEncoder. +~~~~~~~ -It must be defined while calling the XmlEncoder encode() method : +The XmlEncoder ``encode()`` method defines a third optional parameter called +``context`` to define soem configuration options for the XmlEncoder:: - $xmlEncoder->encode($array, 'xml', $context); + $xmlEncoder->encode($array, 'xml', $context); -**Available params :** +These are the options available: ``xml_format_output`` -If set to true, format the output XML with line break and indentation + If set to true, format the output XML with line breaks and indentation. ``xml_version`` -Change the XML version attribute + Change the XML version attribute. ``xml_encoding`` -Change the XML encoding attribute + Change the XML encoding attribute. ``xml_standalone`` -Add standalone attribute in XML output + Add standalone attribute in XML output . ``xml_root_node_name`` -Change the root node name (default : response) +   Change the root node name (default: ``response``). ``remove_empty_tags`` -If set to true, remove all empty tags in the XML output + If set to true, remove all empty tags in the XML output. Learn more ---------- From 4d6281e547cea31002e88eab373f1a07a574ac02 Mon Sep 17 00:00:00 2001 From: Adrien Moiraud Date: Thu, 8 Dec 2016 09:49:43 +0100 Subject: [PATCH 6/7] Minor syntax issue --- components/serializer.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/serializer.rst b/components/serializer.rst index 8859ed281ce..bd4025b202b 100644 --- a/components/serializer.rst +++ b/components/serializer.rst @@ -708,7 +708,7 @@ Context ~~~~~~~ The XmlEncoder ``encode()`` method defines a third optional parameter called -``context`` to define soem configuration options for the XmlEncoder:: +``context`` to define some configuration options for the XmlEncoder:: $xmlEncoder->encode($array, 'xml', $context); From 7057482219e7847685bfe8101ca4378359b3fb30 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 11 Oct 2017 16:09:54 +0200 Subject: [PATCH 7/7] Minor rewords --- components/serializer.rst | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/components/serializer.rst b/components/serializer.rst index bd4025b202b..2676b5f0a9e 100644 --- a/components/serializer.rst +++ b/components/serializer.rst @@ -674,7 +674,7 @@ you indicate that you're expecting an array instead of a single object. $data = ...; // The serialized data from the previous example $persons = $serializer->deserialize($data, 'Acme\Person[]', 'json'); - + The ``XmlEncoder`` ------------------ @@ -696,41 +696,41 @@ The ``XmlEncoder`` encodes this object as follows: The array keys beginning with ``@`` are considered XML attributes:: - $encoder = new XmlEncoder(); - $encoder->encode(array('foo' => array('@bar' => 'value'))); - // will return: + array('foo' => array('@bar' => 'value')); + + // is encoded as follows: // // // // - + Context ~~~~~~~ -The XmlEncoder ``encode()`` method defines a third optional parameter called -``context`` to define some configuration options for the XmlEncoder:: +The ``encode()`` method defines a third optional parameter called ``context`` +which defines the configuration options for the XmlEncoder an associative array:: $xmlEncoder->encode($array, 'xml', $context); These are the options available: - + ``xml_format_output`` - If set to true, format the output XML with line breaks and indentation. + If set to true, formats the generated XML with line breaks and indentation. ``xml_version`` - Change the XML version attribute. + Sets the XML version attribute (default: ``1.1``). ``xml_encoding`` - Change the XML encoding attribute. + Sets the XML encoding attribute (default: ``utf-8``). ``xml_standalone`` - Add standalone attribute in XML output . + Adds standalone attribute in the generated XML (default: ``true``). ``xml_root_node_name`` -   Change the root node name (default: ``response``). +   Sets the root node name (default: ``response``). ``remove_empty_tags`` - If set to true, remove all empty tags in the XML output. + If set to true, removes all empty tags in the generated XML. Learn more ---------- pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy