xml_reference.rst 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. XML Reference
  2. -------------
  3. ::
  4. <!-- MyBundle\Resources\config\serializer\Fully.Qualified.ClassName.xml -->
  5. <?xml version="1.0" encoding="UTF-8" ?>
  6. <serializer>
  7. <class name="Fully\Qualified\ClassName" exclusion-policy="ALL" xml-root-name="foo-bar" exclude="true"
  8. accessor-order="custom" custom-accessor-order="propertyName1,propertyName2,...,propertyNameN"
  9. access-type="public_method" discriminator-field-name="type" discriminator-disabled="false" read-only="false">
  10. <xml-namespace prefix="atom" uri="http://www.w3.org/2005/Atom"/>
  11. <xml-discriminator attribute="true" cdata="false" namespace=""/>
  12. <discriminator-class value="some-value">ClassName</discriminator-class>
  13. <discriminator-groups>
  14. <group>foo</group>
  15. </discriminator-groups>
  16. <property name="some-property"
  17. exclude="true"
  18. expose="true"
  19. exclude-if="expr"
  20. expose-if="expr"
  21. skip-when-empty="false"
  22. type="string"
  23. serialized-name="foo"
  24. since-version="1.0"
  25. until-version="1.1"
  26. xml-attribute="true"
  27. xml-value="true"
  28. access-type="public_method"
  29. accessor-getter="getSomeProperty"
  30. accessor-setter="setSomeProperty"
  31. inline="true"
  32. read-only="true"
  33. groups="foo,bar"
  34. xml-key-value-pairs="true"
  35. xml-attribute-map="true"
  36. max-depth="2"
  37. >
  38. <!-- You can also specify the type as element which is necessary if
  39. your type contains "<" or ">" characters. -->
  40. <type><![CDATA[]]></type>
  41. <xml-list inline="true" entry-name="foobar" namespace="http://www.w3.org/2005/Atom" skip-when-empty="true" />
  42. <xml-map inline="true" key-attribute-name="foo" entry-name="bar" namespace="http://www.w3.org/2005/Atom" />
  43. <xml-element cdata="false" namespace="http://www.w3.org/2005/Atom"/>
  44. <groups>
  45. <value>foo</value>
  46. <value>bar</value>
  47. </groups>
  48. </property>
  49. <callback-method name="foo" type="pre-serialize" />
  50. <callback-method name="bar" type="post-serialize" />
  51. <callback-method name="baz" type="post-deserialize" />
  52. <callback-method name="serializeToXml" type="handler" direction="serialization" format="xml" />
  53. <callback-method name="deserializeFromJson" type="handler" direction="deserialization" format="xml" />
  54. <virtual-property method="public_method"
  55. name="some-property"
  56. exclude="true"
  57. expose="true"
  58. skip-when-empty="false"
  59. type="string"
  60. serialized-name="foo"
  61. since-version="1.0"
  62. until-version="1.1"
  63. xml-attribute="true"
  64. access-type="public_method"
  65. accessor-getter="getSomeProperty"
  66. accessor-setter="setSomeProperty"
  67. inline="true"
  68. read-only="true"
  69. groups="foo,bar"
  70. xml-key-value-pairs="true"
  71. xml-attribute-map="true"
  72. max-depth="2"
  73. >
  74. <virtual-property expression="object.getName()"
  75. name="some-property"
  76. exclude="true"
  77. expose="true"
  78. type="string"
  79. serialized-name="foo"
  80. since-version="1.0"
  81. until-version="1.1"
  82. xml-attribute="true"
  83. access-type="public_method"
  84. accessor-getter="getSomeProperty"
  85. accessor-setter="setSomeProperty"
  86. inline="true"
  87. read-only="true"
  88. groups="foo,bar"
  89. xml-key-value-pairs="true"
  90. xml-attribute-map="true"
  91. max-depth="2"
  92. >
  93. <!-- You can also specify the type as element which is necessary if
  94. your type contains "<" or ">" characters. -->
  95. <type><![CDATA[]]></type>
  96. <groups>
  97. <value>foo</value>
  98. <value>bar</value>
  99. </groups>
  100. <xml-list inline="true" entry-name="foobar" namespace="http://www.w3.org/2005/Atom" skip-when-empty="true" />
  101. <xml-map inline="true" key-attribute-name="foo" entry-name="bar" namespace="http://www.w3.org/2005/Atom" />
  102. </virtual-property>
  103. </class>
  104. </serializer>