Skip to content

Commit a1fa4aa

Browse files
committed
Added documentation for the @xml change
1 parent bb661a1 commit a1fa4aa

2 files changed

Lines changed: 34 additions & 0 deletions

File tree

LSS/Array2XML.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@
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);

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,38 @@ $array = XML2Array::createArray($xml);
1515
print_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+
1850
Reference
1951
----
2052
More complete references can be found here

0 commit comments

Comments
 (0)