How to use the @xmpp/xml.parse function in @xmpp/xml

To help you get started, we’ve selected a few @xmpp/xml examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github xmppjs / xmpp.js / packages / console / lib / Console.js View on Github external
beautify(frag) {
    let el
    if (typeof frag === 'string') {
      try {
        el = xml.parse(frag)
      } catch (err) {
        return frag
      }
    } else {
      el = frag
    }
    return xml.stringify(el, '  ')
  }
github xmppjs / xmpp.js / packages / console / lib / Console.js View on Github external
parse(str) {
    try {
      return xml.parse(str)
    } catch (err) {
      return str
    }
  }
github xmppjs / xmpp.js / packages / console / lib / Console.js View on Github external
send(data) {
    let el
    try {
      el = xml.parse(data)
    } catch (err) {
      this.error(`invalid XML "${data}"`)
      return
    }

    this.entity.send(el).then(() => {
      this.resetInput()
    })
  }