Function: soap-namespace-get

soap-namespace-get is a byte-compiled function defined in soap-client.el.gz.

Signature

(soap-namespace-get NAME NS &optional DISCRIMINANT-PREDICATE)

Documentation

Retrieve an element with NAME from the namespace NS.

If multiple elements with the same name exist, DISCRIMINANT-PREDICATE is used to pick one of them. This allows storing elements of different types (like a message type and a binding) but the same name.

Source Code

;; Defined in /usr/src/emacs/lisp/net/soap-client.el.gz
(defun soap-namespace-get (name ns &optional discriminant-predicate)
  "Retrieve an element with NAME from the namespace NS.
If multiple elements with the same name exist,
DISCRIMINANT-PREDICATE is used to pick one of them.  This allows
storing elements of different types (like a message type and a
binding) but the same name."
  (cl-assert (stringp name))
  (let ((elements (gethash name (soap-namespace-elements ns))))
    (cond (discriminant-predicate
           (catch 'found
             (dolist (e elements)
               (when (funcall discriminant-predicate e)
                 (throw 'found e)))))
          ((= (length elements) 1) (car elements))
          ((> (length elements) 1)
           (error
            "Soap-namespace-get(%s): multiple elements, discriminant needed"
            name))
          (t
           nil))))