Class: Stanza

Stanza(strings, values)

A Stanza represents a XML element used in XMPP (commonly referred to as stanzas).

Constructor

new Stanza(strings, values)

Parameters:
Name Type Description
strings Array.<string>
values Array.<any>
Source:

Classes

Stanza

Members

(private) string :string

Type:
  • string
Source:

(private) strings :Array.<string>

Type:
  • Array.<string>
Source:

Methods

toString() → {string}

Source:
Returns:
Type
string

(static) toElement(string, throwErrorIfInvalidNSopt) → {Element}

Turns the passed-in string into an XML Element.

Parameters:
Name Type Attributes Description
string string
throwErrorIfInvalidNS boolean <optional>
Source:
Returns:
Type
Element

(static) unsafeXML(string) → {Builder}

A directive which can be used to pass a string of XML as a value to the stx tagged template literal.

It's considered "unsafe" because it can pose a security risk if used with untrusted input.

Parameters:
Name Type Description
string string
Source:
Returns:
Type
Builder
Example
const status = '<status>I am busy!</status>';
   const pres = stx`
      <presence from='juliet@example.com/chamber' id='pres1'>
          <show>dnd</show>
          ${unsafeXML(status)}
      </presence>`;
   connection.send(pres);