Skip to content

Commit

Permalink
Merge pull request #562 from Omega-Ariston/addDocExample
Browse files Browse the repository at this point in the history
complete README example usage
  • Loading branch information
Leonidas-from-XIV authored Mar 27, 2020
2 parents 8fc5b92 + a44bad4 commit 0d71785
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,16 @@ var obj = {name: "Super", Surname: "Man", age: 23};
var builder = new xml2js.Builder();
var xml = builder.buildObject(obj);
```
will result in:

```xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<root>
<name>Super</name>
<Surname>Man</Surname>
<age>23</age>
</root>
```

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

### Adding xmlns attributes

Expand Down

0 comments on commit 0d71785

Please sign in to comment.