xml_reference.rst 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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" />
  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. </property>
  45. <callback-method name="foo" type="pre-serialize" />
  46. <callback-method name="bar" type="post-serialize" />
  47. <callback-method name="baz" type="post-deserialize" />
  48. <callback-method name="serializeToXml" type="handler" direction="serialization" format="xml" />
  49. <callback-method name="deserializeFromJson" type="handler" direction="deserialization" format="xml" />
  50. <virtual-property method="public_method"
  51. name="some-property"
  52. exclude="true"
  53. expose="true"
  54. skip-when-empty="false"
  55. type="string"
  56. serialized-name="foo"
  57. since-version="1.0"
  58. until-version="1.1"
  59. xml-attribute="true"
  60. access-type="public_method"
  61. accessor-getter="getSomeProperty"
  62. accessor-setter="setSomeProperty"
  63. inline="true"
  64. read-only="true"
  65. groups="foo,bar"
  66. xml-key-value-pairs="true"
  67. xml-attribute-map="true"
  68. max-depth="2"
  69. >
  70. <virtual-property expression="object.getName()"
  71. name="some-property"
  72. exclude="true"
  73. expose="true"
  74. type="string"
  75. serialized-name="foo"
  76. since-version="1.0"
  77. until-version="1.1"
  78. xml-attribute="true"
  79. access-type="public_method"
  80. accessor-getter="getSomeProperty"
  81. accessor-setter="setSomeProperty"
  82. inline="true"
  83. read-only="true"
  84. groups="foo,bar"
  85. xml-key-value-pairs="true"
  86. xml-attribute-map="true"
  87. max-depth="2"
  88. >
  89. <!-- You can also specify the type as element which is necessary if
  90. your type contains "<" or ">" characters. -->
  91. <type><![CDATA[]]></type>
  92. <xml-list inline="true" entry-name="foobar" />
  93. <xml-map inline="true" key-attribute-name="foo" entry-name="bar" />
  94. </virtual-property>
  95. </class>
  96. </serializer>