code: func (d *Decoder) popElement(t *EndElement) bool {
  	s := d.pop()
  	name := t.Name
  	switch {
  	case s == nil || s.kind != stkStart:
  		d.err = d.syntaxError("unexpected end element </" + name.Local + ">")
  		return false
  	case s.name.Local != name.Local:
  		if !d.Strict {
  			d.needClose = true
  			d.toClose = t.Name
  			t.Name = s.name
  			return true
  		}
  		d.err = d.syntaxError("element <" + s.name.Local + "> closed by </" + name.Local + ">")
  		return false
  	case s.name.Space != name.Space:
  		d.err = d.syntaxError("element <" + s.name.Local + "> in space " + s.name.Space +
  			"closed by </" + name.Local + "> in space " + name.Space)
  		return false
  	}
  
  	// Pop stack until a Start or EOF is on the top, undoing the
  	// translations that were associated with the element we just closed.
  	for d.stk != nil && d.stk.kind != stkStart && d.stk.kind != stkEOF {
  		s := d.pop()
  		if s.ok {
  			d.ns[s.name.Local] = s.name.Space
  		} else {
  			delete(d.ns, s.name.Local)
  		}
  	}
  
  	return true
  }
docs: // Record that we are ending an element with the given name.
  // The name must match the record at the top of the stack,
  // which must be a pushElement record.
  // After popping the element, apply any undo records from
  // the stack to restore the name translations that existed
  // before we saw this element.