Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
onEndElement(name) {
const {cursor} = this
if (name !== cursor.name) {
//
this.emit('error', new XMLError(`${cursor.name} must be closed.`))
return
}
if (cursor.parent) {
this.cursor = cursor.parent
return
}
if (cursor.is('open', 'urn:ietf:params:xml:ns:xmpp-framing')) {
this.emit('start', cursor)
} else if (cursor.is('close', 'urn:ietf:params:xml:ns:xmpp-framing')) {
this.emit('end', cursor)
} else {
this.emit('element', cursor)
}