Skip to content

Commit 0fd086b

Browse files
committed
minor symfony#9249 Add example of setting the data of XML nodes (pyatnitsev, javiereguiluz)
This PR was submitted for the 4.0 branch but it was merged into the 3.4 branch instead (closes symfony#9249). Discussion ---------- Add example of setting the data of XML nodes Add an example serialization of node with attribute and value in same time Commits ------- 7c862db Minor reword d415361 fix minor syntax issue 51ba232 fix makeup c4aecf4 add example
2 parents db70285 + 7c862db commit 0fd086b

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

components/serializer.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -903,6 +903,18 @@ The array keys beginning with ``@`` are considered XML attributes::
903903
// <foo bar="value" />
904904
// </response>
905905

906+
Use the special ``#`` key to define the data of a node::
907+
908+
array('foo' => array('@bar' => 'value', '#' => 'baz'));
909+
910+
// is encoded as follows:
911+
// <?xml version="1.0"?>
912+
// <response>
913+
// <foo bar="value">
914+
// baz
915+
// </foo>
916+
// </response>
917+
906918
Context
907919
~~~~~~~
908920

0 commit comments

Comments
 (0)