File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4949 * - Reverted to version 0.5
5050 * Version: 0.8 (02 May 2012)
5151 * - Removed htmlspecialchars() before adding to text node or attributes.
52+ * Version: 0.11 (28 October 2015)
53+ * - Fixed typos; Added support for plain insertion of XML trough @xml.
5254 *
5355 * Usage:
5456 * $xml = Array2XML::createXML('root_node_name', $php_array);
Original file line number Diff line number Diff line change @@ -15,6 +15,38 @@ $array = XML2Array::createArray($xml);
1515print_r($array);
1616```
1717
18+ Array2XML
19+ ----
20+
21+ @xml example:
22+ ``` php
23+ // Build the array that should be transformed into a XML object.
24+ $array = [
25+ 'title' => 'A title',
26+ 'body' => [
27+ '@xml' => '<html ><body ><p >The content for the news item</p ></body ></html >',
28+ ],
29+ ];
30+
31+ // Use the Array2XML object to transform it.
32+ $xml = Array2XML::createXML('news', $array);
33+ echo $xml->saveXML();
34+ ```
35+ This will result in the following.
36+ ``` xml
37+ <?xml version =" 1.0" encoding =" UTF-8" ?>
38+ <news >
39+ <title >A title</title >
40+ <body >
41+ <html >
42+ <body >
43+ <p >The content for the news item</p >
44+ </body >
45+ </html >
46+ </body >
47+ </news >
48+ ```
49+
1850Reference
1951----
2052More complete references can be found here
You can’t perform that action at this time.
0 commit comments