Skip to content

Commit a3ae596

Browse files
author
chenjiechuan 00492660
committed
append example to README for issue #552
1 parent 8fc5b92 commit a3ae596

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,16 @@ var obj = {name: "Super", Surname: "Man", age: 23};
180180
var builder = new xml2js.Builder();
181181
var xml = builder.buildObject(obj);
182182
```
183+
will result in:
184+
185+
```
186+
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
187+
<root>
188+
<name>Super</name>
189+
<Surname>Man</Surname>
190+
<age>23</age>
191+
</root>
192+
```
183193

184194
At the moment, a one to one bi-directional conversion is guaranteed only for
185195
default configuration, except for `attrkey`, `charkey` and `explicitArray` options
@@ -195,6 +205,11 @@ var obj = {root: {$: {id: "my id"}, _: "my inner text"}};
195205
var builder = new xml2js.Builder();
196206
var xml = builder.buildObject(obj);
197207
```
208+
will result in:
209+
```
210+
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
211+
<root id="my id">my inner text</root>
212+
```
198213

199214
### Adding xmlns attributes
200215

0 commit comments

Comments
 (0)