diff --git a/packages/xml/README.md b/packages/xml/README.md index d61f15a2..49a76450 100644 --- a/packages/xml/README.md +++ b/packages/xml/README.md @@ -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('hello world'); +ctx.getChildText("body"); // hello world +``` + ## JSON You can embed JSON anywhere but it is recommended to use an appropriate semantic.