Function: soap-extract-xmlns

soap-extract-xmlns is a byte-compiled function defined in soap-client.el.gz.

Signature

(soap-extract-xmlns NODE &optional XMLNS-TABLE)

Documentation

Return a namespace alias table for NODE by extending XMLNS-TABLE.

Source Code

;; Defined in /usr/src/emacs/lisp/net/soap-client.el.gz
(defun soap-extract-xmlns (node &optional xmlns-table)
  "Return a namespace alias table for NODE by extending XMLNS-TABLE."
  (let (xmlns default-ns target-ns)
    (dolist (a (xml-node-attributes node))
      (let ((name (symbol-name (car a)))
            (value (cdr a)))
        (cond ((string= name "targetNamespace")
               (setq target-ns value))
              ((string= name "xmlns")
               (setq default-ns value))
              ((string-match "^xmlns:\\(.*\\)$" name)
               (push (cons (match-string 1 name) value) xmlns)))))

    (let ((tns (assoc "tns" xmlns)))
      (cond ((and tns target-ns)
             ;; If a tns alias is defined for this node, it must match
             ;; the target namespace.
             (unless (equal target-ns (cdr tns))
               (soap-warning
                "soap-extract-xmlns(%s): tns alias and targetNamespace mismatch"
                (xml-node-name node))))
            ((and tns (not target-ns))
             (setq target-ns (cdr tns)))))

    (list default-ns target-ns (append xmlns xmlns-table))))