Selaa lähdekoodia

Updated documentation

Miha Vrhovnik 11 vuotta sitten
vanhempi
commit
787014d065

+ 25 - 0
doc/reference/annotations.rst

@@ -398,6 +398,8 @@ Resulting XML:
 This allows you to mark properties which should be set as the value of the
 This allows you to mark properties which should be set as the value of the
 current element. Note that this has the limitation that any additional
 current element. Note that this has the limitation that any additional
 properties of that object must have the @XmlAttribute annotation.
 properties of that object must have the @XmlAttribute annotation.
+XMlValue also has property cdata. Which has the same meaning as the one in
+XMLElement.
 
 
 .. code-block :: php
 .. code-block :: php
 
 
@@ -508,3 +510,26 @@ Resulting XML:
 .. code-block :: xml
 .. code-block :: xml
 
 
     <result name="firstname" value="Adrien"/>
     <result name="firstname" value="Adrien"/>
+
+@XmlElement
+~~~~~~~~
+This annotation can be defined on a property to add additional xml serialization/deserialization properties.
+
+.. code-block :: php
+
+    <?php
+    use JMS\Serializer\Annotation\XmlElement;
+
+    class User
+    {
+        /**
+        * @XmlElement(cdata=false)
+        */
+        private $id = 'my_id;
+    }
+
+Resulting XML:
+
+.. code-block :: xml
+
+    <id>my_id</id>

+ 1 - 0
doc/reference/xml_reference.rst

@@ -32,6 +32,7 @@ XML Reference
                 <type><![CDATA[]]></type>
                 <type><![CDATA[]]></type>
                 <xml-list inline="true" entry-name="foobar" />
                 <xml-list inline="true" entry-name="foobar" />
                 <xml-map inline="true" key-attribute-name="foo" entry-name="bar" />
                 <xml-map inline="true" key-attribute-name="foo" entry-name="bar" />
+                <xml-element cdata="false" />
             </property>
             </property>
             <callback-method name="foo" type="pre-serialize" />
             <callback-method name="foo" type="pre-serialize" />
             <callback-method name="bar" type="post-serialize" />
             <callback-method name="bar" type="post-serialize" />

+ 2 - 0
doc/reference/yml_reference.rst

@@ -42,6 +42,8 @@ YAML Reference
                     key_attribute_name: foo
                     key_attribute_name: foo
                     entry_name: bar
                     entry_name: bar
                 xml_attribute_map: true
                 xml_attribute_map: true
+                xml_element:
+                    cdata: false
                 max_depth: 2
                 max_depth: 2
 
 
         handler_callbacks:
         handler_callbacks: