Skip to content

Commit

Permalink
Mention XML string parse script
Browse files Browse the repository at this point in the history
  • Loading branch information
silverbucket authored and sonnyp committed Mar 14, 2021
1 parent 1e775fd commit dd6b4e3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/xml/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,16 @@ const body = message.getChild("body");
message.remove(body);
```

## Parsing XML string

To parse a string into an XML Element, there's a helper script included in the module.

```js
const parse = require('@xmpp/xml/lib/parse');
const ctx = parse('<message><body>hello world</body></message>');
ctx.getChildText("body"); // hello world
```

## JSON

You can embed JSON anywhere but it is recommended to use an appropriate semantic.
Expand Down

0 comments on commit dd6b4e3

Please sign in to comment.